Avagard Posted May 3, 2017 Share Posted May 3, 2017 idk what is the problem i am trying to trigger for player after 2 mins but it doesn't work (setelment works) error: expected string at argument 1,got nil code(serverside): endtimeRound1 = setTimer ( function() local getCTscore1 = getElementData(scoreCT1,"roundswonbyct1") local getTscore1 = getElementData(scoreT1,"roundswonbyt1") setElementData(scoreCT1,"roundswonbyct1",getElementData(scoreCT1,"roundswonbyct1")+1) triggerClientEvent (source, "getitServer1",source, getCTscore1,getTscore1) end, 129000, 0) Link to comment
Avagard Posted May 3, 2017 Author Share Posted May 3, 2017 the player that is getting triggered? is that wrong? Link to comment
Avagard Posted May 3, 2017 Author Share Posted May 3, 2017 (edited) function omg1(getCTscore1,getTscore1) local player = getLocalPlayer() setElementData(player,"ClientCTWins1",getCTscore1) setElementData(player,"ClientTWins1",getTscore1) end addEvent("getitServer1",true) addEventHandler("getitServer1",root,omg1) client and scoreCT1 is just an object so it doesn't matter Edited May 3, 2017 by Avagard Link to comment
NeXuS™ Posted May 3, 2017 Share Posted May 3, 2017 Copy the server-sided function, which calls this event. Link to comment
Avagard Posted May 3, 2017 Author Share Posted May 3, 2017 there is no function its just setTimer i just want to trigger it for the player in time Link to comment
NeXuS™ Posted May 3, 2017 Share Posted May 3, 2017 endtimeRound1 = setTimer ( function() local getCTscore1 = getElementData(scoreCT1,"roundswonbyct1") local getTscore1 = getElementData(scoreT1,"roundswonbyt1") setElementData(scoreCT1, "roundswonbyct1",getElementData(scoreCT1,"roundswonbyct1")+1) triggerClientEvent("getitServer1", resourceRoot, getCTscore1,getTscore1) end, 129000, 0) Link to comment
Avagard Posted May 3, 2017 Author Share Posted May 3, 2017 hold on please i will test not working Link to comment
NeXuS™ Posted May 3, 2017 Share Posted May 3, 2017 "Not working". Won't help, whats not working mate? Link to comment
NeXuS™ Posted May 3, 2017 Share Posted May 3, 2017 Add debugging.... endtimeRound1 = setTimer(function() local getCTscore1 = getElementData(scoreCT1, "roundswonbyct1") local getTscore1 = getElementData(scoreT1, "roundswonbyt1") setElementData(scoreCT1, "roundswonbyct1", getElementData(scoreCT1, "roundswonbyct1") + 1) triggerClientEvent("getitServer1", resourceRoot, getCTscore1, getTscore1) outputChatBox("Trigger") end, 129000, 0) 1 Link to comment
Avagard Posted May 3, 2017 Author Share Posted May 3, 2017 nvm! i found the problem! endtimeRound1 = setTimer ( function() setElementData(scoreCT1, "roundswonbyct1",getElementData(scoreCT1,"roundswonbyct1")+1) local getCTscore1 = getElementData(scoreCT1,"roundswonbyct1") -- this should have been here local getTscore1 = getElementData(scoreT1,"roundswonbyt1") -- this should have been here triggerClientEvent("getitServer1", resourceRoot, getCTscore1,getTscore1) end, 129000, 0) thanks just a fast question.. resourceRoot what will it do? is it for only the player? Link to comment
pa3ck Posted May 5, 2017 Share Posted May 5, 2017 resourceRoot is a predefined variable, meaning resourceRoot = getResourceRootElement(getThisResource()) localPlayer = getLocalPlayer() root = getRootElement() etc... You can find the list of predefined variables here: As for the meaning, it returns all the elements associated with the current resource, not just players, but the everything as opposed to getRootElement() which returns all the elements associated with every resource. 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