@@ -8,6 +8,7 @@ local config = require 'config.server'.mining
88
99local orePoints = {}
1010local lightPoints = {}
11+ local miningBlips = {}
1112
1213RegisterNetEvent (' red40_mining:server:startMining' , function (oreId )
1314 local src = source
@@ -25,7 +26,6 @@ RegisterNetEvent('red40_mining:server:startMining', function(oreId)
2526 return
2627 end
2728
28- -- Distance Check
2929 local coords = GetEntityCoords (GetPlayerPed (src ))
3030 if # (coords - orePoint .coords ) > 5.0 then
3131 Notify (src , locale (' error.too_far' ), ' error' )
@@ -44,7 +44,7 @@ RegisterNetEvent('red40_mining:server:startMining', function(oreId)
4444
4545 local waitTime = math.random (config .tools [tool ].minUseTime , config .tools [tool ].maxUseTime )
4646
47- local success = lib .callback .await (' red40_mining:client:mineSpot' , src , waitTime , config .tools [tool ].type )
47+ local success = lib .callback .await (' red40_mining:client:mineSpot' , src , waitTime , config .tools [tool ].type )
4848
4949 if success and not orePoint .looted then
5050 orePoints [orePoint .id ].looted = true
@@ -76,10 +76,10 @@ RegisterNetEvent('red40_mining:server:startMining', function(oreId)
7676 for itemName , v in pairs (items ) do
7777 if not CanCarryItem (src , itemName , v .amount , v .metadata ) then
7878 lib .print .debug (' Player ' .. src .. ' cannot carry item ' .. itemName .. ' x' .. v .amount )
79- itemList [# itemList + 1 ] = {itemName , v .amount , v .metadata }
79+ itemList [# itemList + 1 ] = { itemName , v .amount , v .metadata }
8080 else
81- AddItem (src , itemName , v .amount , v .metadata )
82- lib .print .debug (' Added items to player ' .. src .. ' : ' , items )
81+ AddItem (src , itemName , v .amount , v .metadata )
82+ lib .print .debug (' Added items to player ' .. src .. ' : ' , items )
8383 end
8484 end
8585 if itemList and next (itemList ) then
@@ -101,21 +101,18 @@ RegisterNetEvent('red40_mining:server:startMining', function(oreId)
101101 local durabilityRemoved = config .durability ()
102102 local durabilityLeft = RemoveItemDurability (src , tool , durabilityRemoved )
103103 lib .print .debug (' Removed ' ..
104- durabilityRemoved .. ' durability from player ' .. src .. ' for mining with tool ' .. tool )
104+ durabilityRemoved .. ' durability from player ' .. src .. ' for mining with tool ' .. tool )
105105 if durabilityLeft and durabilityLeft <= 0 then
106106 Notify (src , locale (' error.tool_broke' ), ' error' )
107- Logger (src , ' red40_mining' , ' Player ' .. src .. ' \' s tool ' .. tool .. ' broke due to durability reaching 0.' )
107+ Logger (src , ' red40_mining' ,
108+ ' Player ' .. src .. ' \' s tool ' .. tool .. ' broke due to durability reaching 0.' )
108109 end
109110 end
110111 end
111112end )
112113
113114lib .callback .register (' red40_mining:server:getMiningPoints' , function (_ )
114- return orePoints
115- end )
116-
117- lib .callback .register (' red40_mining:server:getMiningLightPoints' , function (_ )
118- return lightPoints
115+ return orePoints , lightPoints , miningBlips
119116end )
120117
121118-- Build ore points
@@ -153,6 +150,15 @@ local function buildPoints()
153150 rot = lightPoint .rotation ,
154151 }
155152 end
153+ if location .blip and location .blip .enabled then
154+ miningBlips [# miningBlips + 1 ] = {
155+ coords = location .blip .coords ,
156+ sprite = location .blip .sprite ,
157+ color = location .blip .color ,
158+ scale = location .blip .scale ,
159+ name = location .blip .name ,
160+ }
161+ end
156162 end
157163end
158164
0 commit comments