Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion [gamemodes]/[race]/race/race_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, du
for k,v in pairs(pickup) do
g_Pickups[colshape][k] = v
end
g_Pickups[colshape].load = true
local isLoaded = not pickup.isRespawning
g_Pickups[colshape].load = isLoaded
if g_Pickups[colshape].type == 'vehiclechange' then
g_Pickups[colshape].label = dxText:create(getVehicleNameFromModel(g_Pickups[colshape].vehicle), 0.5, 0.5)
g_Pickups[colshape].label:color(255, 255, 255, 0)
Expand Down
15 changes: 5 additions & 10 deletions [gamemodes]/[race]/race/race_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ g_Pickups = {} -- { i = { position={x, y, z}, type=type, vehicle=vehicleID, p
g_Players = {} -- { i = player }
g_Vehicles = {} -- { player = vehicle }

local unloadedPickups = {}


addEventHandler('onPlayerJoin', g_Root,
Expand Down Expand Up @@ -659,10 +658,10 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
local pickup = g_Pickups[table.find(g_Pickups, 'id', pickupID)]
local vehicle = g_Vehicles[source]
if not pickup or not vehicle then return end
if respawntime and tonumber(respawntime) >= 50 then
table.insert(unloadedPickups, pickupID)
clientCall(g_Root, 'unloadPickup', pickupID)
if respawntime and tonumber(respawntime) >= 50 and not pickup.isRespawning then
pickup.isRespawning = true
TimerManager.createTimerFor("map"):setTimer(ServerLoadPickup, tonumber(respawntime), 1, pickupID)
clientCall(g_Root, 'unloadPickup', pickupID)
end
if pickup.type == 'nitro' then
addVehicleUpgrade(vehicle, 1010)
Expand All @@ -680,7 +679,8 @@ addEventHandler('onPlayerPickUpRacePickupInternal', g_Root,
)

function ServerLoadPickup(pickupID)
table.removevalue(unloadedPickups, pickupID)
local pickup = g_Pickups[table.find(g_Pickups, 'id', pickupID)]
pickup.isRespawning = nil
clientCall(g_Root, 'loadPickup', pickupID)
end

Expand Down Expand Up @@ -744,7 +744,6 @@ function unloadAll()
g_Checkpoints = {}
g_Objects = {}
g_Pickups = {}
unloadedPickups = {}
if g_CurrentRaceMode then
g_CurrentRaceMode:destroy()
end
Expand Down Expand Up @@ -1009,10 +1008,6 @@ addEventHandler('onNotifyPlayerReady', g_Root,
function()
if checkClient( false, source, 'onNotifyPlayerReady' ) then return end
setPlayerReady( source )
for i, pickupID in ipairs(unloadedPickups) do
-- outputDebugString(getPlayerName(source).." unload "..tostring(pickupID))
clientCall(source, "unloadPickup", pickupID )
end
end
)

Expand Down