Death Posted October 24, 2014 Share Posted October 24, 2014 (edited) hello I need help I am not able to pass the parameter result follows an excerpt below result = 0 setTimer (function () if result <= 25 then result = members_in_turf [team] [zone] + result triggerClientEvent ("OnTimer" theplayer, result) outputChatBox ("" .. tonumber (result) .. "") end Edited October 24, 2014 by Guest Link to comment
manawydan Posted October 24, 2014 Share Posted October 24, 2014 SetTimer? try setTimer Link to comment
iPanda Posted October 24, 2014 Share Posted October 24, 2014 you do not set the timer value after the function has been end (milliseconds,repeat). Try that. result = 0 setTimer (function () if result <= 25 then result = members_in_turf [team] [zone] + result triggerClientEvent ("OnTimer" theplayer, result) outputChatBox ("" .. tonumber (result) .. "") end--you forgot end,1000,1)--value for set the timer after 'end' and I recommend reading: https://wiki.multitheftauto.com/wiki/SetTimer Link to comment
Death Posted October 24, 2014 Author Share Posted October 24, 2014 well this is my full function however when passing the parameter and try recebelo the client file the result is null. help me function teste(thePlayer) local gang = getPlayerTeam(thePlayer) local team = getTeamName(gang) local x, y, z = getElementPosition ( thePlayer ); local zona = getZoneName ( x, y, z, false ); resultado = 0 setTimer(function() if resultado <= 25 then resultado = members_in_turf[team][zona] + resultado triggerClientEvent("onTimer", thePlayer, resultado) outputChatBox(""..tonumber(resultado).."") end end,5000,0) end Link to comment
iPanda Posted October 24, 2014 Share Posted October 24, 2014 may be you need to add event for function 'teste'? Link to comment
Death Posted October 24, 2014 Author Share Posted October 24, 2014 may be you need to add event for function 'teste'? it is called by another function Link to comment
Death Posted October 24, 2014 Author Share Posted October 24, 2014 I think I did not explain right. I'm having problems when passing a value as a parameter in the trigger, and receive the value in the client file below this codes server-- function teste(thePlayer) local gang = getPlayerTeam(thePlayer) local team = getTeamName(gang) local x, y, z = getElementPosition ( thePlayer ); local zona = getZoneName ( x, y, z, false ); resultado = 0 setTimer(function() if resultado <= 25 then resultado = members_in_turf[team][zona] + resultado triggerClientEvent("onTimer", thePlayer, resultado) outputChatBox(""..tonumber(resultado).."") end end,5000,0) end ---client function testee(thePlayer,resultado) outputChatBox("Verme ="..tostring(resultado).."") removeEventHandler("onClientRender", root, tempo) addEventHandler("onClientRender", root, tempo) end addEvent("onTimer", true) addEventHandler("onTimer", getLocalPlayer(), testee) Link to comment
.:HyPeX:. Posted October 25, 2014 Share Posted October 25, 2014 triggerClientEvent(thePlayer,"onTimer", thePlayer, resultado) --Client function testee(resultado) outputChatBox("Verme ="..tostring(resultado).."") removeEventHandler("onClientRender", root, tempo) addEventHandler("onClientRender", root, tempo) end addEvent("onTimer", true) addEventHandler("onTimer", getLocalPlayer(), testee) Read correctly how they work. Link to comment
.:HyPeX:. Posted October 25, 2014 Share Posted October 25, 2014 thanks. hugs You're Welcome. PD: next time dont use google translator, go directly into the spanish sub-forum viewforum.php?f=145 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now