@@ -19,7 +19,6 @@ g_Pickups = {} -- { i = { position={x, y, z}, type=type, vehicle=vehicleID, p
19
19
g_Players = {} -- { i = player }
20
20
g_Vehicles = {} -- { player = vehicle }
21
21
22
- local unloadedPickups = {}
23
22
24
23
25
24
addEventHandler (' onPlayerJoin' , g_Root ,
@@ -659,10 +658,10 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
659
658
local pickup = g_Pickups [table .find (g_Pickups , ' id' , pickupID )]
660
659
local vehicle = g_Vehicles [source ]
661
660
if not pickup or not vehicle then return end
662
- if respawntime and tonumber (respawntime ) >= 50 then
663
- table.insert (unloadedPickups , pickupID )
664
- clientCall (g_Root , ' unloadPickup' , pickupID )
661
+ if respawntime and tonumber (respawntime ) >= 50 and not pickup .isRespawning then
662
+ pickup .isRespawning = true
665
663
TimerManager .createTimerFor (" map" ):setTimer (ServerLoadPickup , tonumber (respawntime ), 1 , pickupID )
664
+ clientCall (g_Root , ' unloadPickup' , pickupID )
666
665
end
667
666
if pickup .type == ' nitro' then
668
667
addVehicleUpgrade (vehicle , 1010 )
@@ -680,7 +679,8 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
680
679
)
681
680
682
681
function ServerLoadPickup (pickupID )
683
- table .removevalue (unloadedPickups , pickupID )
682
+ local pickup = g_Pickups [table .find (g_Pickups , ' id' , pickupID )]
683
+ pickup .isRespawning = nil
684
684
clientCall (g_Root , ' loadPickup' , pickupID )
685
685
end
686
686
@@ -744,7 +744,6 @@ function unloadAll()
744
744
g_Checkpoints = {}
745
745
g_Objects = {}
746
746
g_Pickups = {}
747
- unloadedPickups = {}
748
747
if g_CurrentRaceMode then
749
748
g_CurrentRaceMode :destroy ()
750
749
end
@@ -1009,10 +1008,6 @@ addEventHandler('onNotifyPlayerReady', g_Root,
1009
1008
function ()
1010
1009
if checkClient ( false , source , ' onNotifyPlayerReady' ) then return end
1011
1010
setPlayerReady ( source )
1012
- for i , pickupID in ipairs (unloadedPickups ) do
1013
- -- outputDebugString(getPlayerName(source).." unload "..tostring(pickupID))
1014
- clientCall (source , " unloadPickup" , pickupID )
1015
- end
1016
1011
end
1017
1012
)
1018
1013
0 commit comments