@@ -19,7 +19,6 @@ g_Pickups = {} -- { i = { position={x, y, z}, type=type, vehicle=vehicleID, p
1919g_Players = {} -- { i = player }
2020g_Vehicles = {} -- { player = vehicle }
2121
22- local unloadedPickups = {}
2322
2423
2524addEventHandler (' onPlayerJoin' , g_Root ,
@@ -659,10 +658,10 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
659658 local pickup = g_Pickups [table .find (g_Pickups , ' id' , pickupID )]
660659 local vehicle = g_Vehicles [source ]
661660 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
665663 TimerManager .createTimerFor (" map" ):setTimer (ServerLoadPickup , tonumber (respawntime ), 1 , pickupID )
664+ clientCall (g_Root , ' unloadPickup' , pickupID )
666665 end
667666 if pickup .type == ' nitro' then
668667 addVehicleUpgrade (vehicle , 1010 )
@@ -680,7 +679,8 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
680679)
681680
682681function ServerLoadPickup (pickupID )
683- table .removevalue (unloadedPickups , pickupID )
682+ local pickup = g_Pickups [table .find (g_Pickups , ' id' , pickupID )]
683+ pickup .isRespawning = nil
684684 clientCall (g_Root , ' loadPickup' , pickupID )
685685end
686686
@@ -744,7 +744,6 @@ function unloadAll()
744744 g_Checkpoints = {}
745745 g_Objects = {}
746746 g_Pickups = {}
747- unloadedPickups = {}
748747 if g_CurrentRaceMode then
749748 g_CurrentRaceMode :destroy ()
750749 end
@@ -1009,10 +1008,6 @@ addEventHandler('onNotifyPlayerReady', g_Root,
10091008 function ()
10101009 if checkClient ( false , source , ' onNotifyPlayerReady' ) then return end
10111010 setPlayerReady ( source )
1012- for i , pickupID in ipairs (unloadedPickups ) do
1013- -- outputDebugString(getPlayerName(source).." unload "..tostring(pickupID))
1014- clientCall (source , " unloadPickup" , pickupID )
1015- end
10161011 end
10171012)
10181013
0 commit comments