kikos500 Posted August 29, 2015 Share Posted August 29, 2015 Client addEventHandler("onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ("onGetPlayerRaceStats", resourceRoot) end ) addEvent("onGotRaceStats", true ) addEventHandler("onGotRaceStats", root, function (wins, dms ) guiSetText( GUIEditor.label[1], "Maps Played: "..tostring(dms)) guiSetText( GUIEditor.label[2], "Maps Won: "..tostring(wins)) end ) ----Server addEvent("onGetPlayerRaceStats", true ) addEventHandler("onGetPlayerRaceStats", root, function ( ) for _ ,v in pairs ( getElementsByType("player") ) do local wins = getElementData(source,"wins") local dms = getElementData(source,"played") triggerClientEvent (v, "onGotRaceStats", v, wins, dms) end end ) idk what should i do but it works fine with /st as you can see in the picture Link to comment
TAPL Posted August 29, 2015 Share Posted August 29, 2015 Server addEvent("onGetPlayerRaceStats", true) addEventHandler("onGetPlayerRaceStats", root, function() local wins = getElementData(client, "wins") local dms = getElementData(client, "played") triggerClientEvent(client, "onGotRaceStats", client, wins, dms) end) And be sure to set the data before the resource start. Link to comment
kikos500 Posted August 29, 2015 Author Share Posted August 29, 2015 Server addEvent("onGetPlayerRaceStats", true) addEventHandler("onGetPlayerRaceStats", root, function() local wins = getElementData(client, "wins") local dms = getElementData(client, "played") triggerClientEvent(client, "onGotRaceStats", client, wins, dms) end) And be sure to set the data before the resource start. well it worked and it loaded the dms and wins and cash and ratio but the problem is that it doesn't update meaning now i have 13 dms and 5 wins i won next round > so /st 14dms and 6 wins but the panel still 13 dms and 5 wins any solutions Link to comment
Walid Posted August 29, 2015 Share Posted August 29, 2015 because you are checking the player stats only onClientResourceStart just try to add a commandHandler. Example function functionName() triggerServerEvent ("onGetPlayerRaceStats", localPlayer) end addCommandHandler("stats",functionName Try now and it will update the player stats everytime you use the stats command. Link to comment
kikos500 Posted August 29, 2015 Author Share Posted August 29, 2015 because you are checking the player stats only onClientResourceStart just try to add a commandHandler.Example function functionName() triggerServerEvent ("onGetPlayerRaceStats", localPlayer) end addCommandHandler("stats",functionName Try now and it will update the player stats everytime you use the stats command. well this example will need you to write a command everytime can i use a timer idk if its possible since i haven't used a one before Link to comment
TAPL Posted August 29, 2015 Share Posted August 29, 2015 I just wonder why you need the trigger in the first place? You can use getElementData client side as long as the sync argument of the data wasn't set to false. Link to comment
kikos500 Posted August 29, 2015 Author Share Posted August 29, 2015 I just wonder why you need the trigger in the first place?You can use getElementData client side as long as the sync argument of the data wasn't set to false. well i tried to do that but it didn't work so i decided to use triggering any idea how to do that ? never mind it worked 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