diff --git a/[gamemodes]/[assault]/assault/assault.lua b/[gamemodes]/[assault]/assault/assault.lua index a92e65b85..7e4aad6cc 100644 --- a/[gamemodes]/[assault]/assault/assault.lua +++ b/[gamemodes]/[assault]/assault/assault.lua @@ -698,18 +698,18 @@ end addEvent("assaultClientScriptLoaded",true) addEventHandler('assaultClientScriptLoaded', root, function() - setElementDataLocal( source, "assaultClientScriptLoaded", true ) - if (assaultClientScriptQueue[source] == nil) then return end - for k,v in ipairs(assaultClientScriptQueue[source]) do - --outputConsole("Triggering queued event '"..v.eventName.."'",source) - triggerClientEvent( source, v.eventName, source, v.parameter ) + setElementDataLocal( client, "assaultClientScriptLoaded", true ) + if (assaultClientScriptQueue[client] == nil) then return end + for k,v in ipairs(assaultClientScriptQueue[client]) do + --outputConsole("Triggering queued event '"..v.eventName.."'",client) + triggerClientEvent( client, v.eventName, client, v.parameter ) end - assaultClientScriptQueue[source] = {} + assaultClientScriptQueue[client] = {} end ) addEventHandler("onPlayerQuit", root, function() - assaultClientScriptQueue[source] = {} + assaultClientScriptQueue[source] = nil end ) diff --git a/[gameplay]/defaultstats/defaultstats.lua b/[gameplay]/defaultstats/defaultstats.lua index dcfa665a0..2fc5770b5 100644 --- a/[gameplay]/defaultstats/defaultstats.lua +++ b/[gameplay]/defaultstats/defaultstats.lua @@ -26,12 +26,18 @@ local function applyStatsForSource() end addEventHandler("onPlayerJoin", root, applyStatsForSource) -local function applyStatsForEveryone() +local function applyStatsForEveryone(loadedResource) + local resourceType = getResourceInfo(loadedResource, "type") + local isGamemodeResource = resourceType == "gamemode" + local isMapResource = resourceType == "map" + + if not (loadedResource == resource or isGamemodeResource or isMapResource) then return end + local playersTable = getElementsByType("player") for playerID = 1, #playersTable do applyStatsForPlayer(playersTable[playerID]) end end -addEventHandler("onResourceStart", resourceRoot, applyStatsForEveryone) +addEventHandler("onResourceStart", root, applyStatsForEveryone) addEventHandler("onGamemodeMapStart", root, applyStatsForEveryone)