Hey.
I have a little problem - idk if I made a mistake there, maybe I need to know something , or it is a bug.
Can some1 explain me how it works and what can I do to be sure it's all ok.
So, I want to do a simple script executed on event "onGamemodeMapStart" (mapmanager triggers that), and send some map info but it looks like arguments are delayed.
There's my example script:
Server-side:
addEventHandler("onGamemodeMapStart", root,
function(mapResource)
local mapRoot = getResourceRootElement(mapResource)
local previews = getElementsByType("preview", mapRoot)
outputChatBox("<server>")
outputChatBox(getElementType(previews[1]))
outputChatBox("</server>")
triggerClientEvent("onServerSendInfo", resourceRoot, previews)
end
)
Client-side:
addEvent("onServerSendInfo", true)
addEventHandler("onServerSendInfo", resourceRoot,
function(theInfo)
outputChatBox("<now>")
outputChatBox(getElementType(theInfo[1]))
outputChatBox("</now>")
setTimer(
function()
outputChatBox("<50ms>")
outputChatBox(getElementType(theInfo[1]))
outputChatBox("</50ms>")
end
, 50, 1)
end
)
Now, when I start a map, with any "preview" element, client gets them, but not at the event time (is delayed). There is client output:
<now>
</now>
<server>
preview
</server>
<50ms>
preview
</50ms>
Tag "now" pops up first (before "server") -> for client it looks that triggerServerEvent executed before outputChatBox right? And the "now" tag has no value, after 50ms it has. (sometimes 50ms is not enought and this tag is also empty)
Why is that?