HUNGRY:3 Posted June 4, 2015 Posted June 4, 2015 hello i'm trying to trigger for server to client but it's give me errors i made a gui button when i click it it must give me the money.... here is the code client.lua function pro2(thePlayer) if source == GUIEditor.button[2] then triggerServerEvent ("onGreeting",thePlayer,setPlayerMoney(thePlayer, 5000000)) end end addEventHandler("onClientGUIClick", root, pro2) server.lua function money( thePlayer ) if getElementData( thePlayer,"VIP") == true then setPlayerMoney(thePlayer, 5000000) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, money )
Walid Posted June 4, 2015 Posted June 4, 2015 -- Client side function pro2() if source == GUIEditor.button[2] then triggerServerEvent ("onGreeting",localPlayer) end end addEventHandler("onClientGUIClick", root, pro2) -- Server side function money( ) if getElementData(source,"VIP") == true then setPlayerMoney(source, 5000000) end end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", root, money ) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Walid Posted June 4, 2015 Posted June 4, 2015 thanks it working :C np. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Tekken Posted June 4, 2015 Posted June 4, 2015 Why don't you make it server side ? setPlayerMoney is a shared function so can be used server and also client. function pro2() if source == GUIEditor.button[2] then setPlayerMoney(localPlayer, 5000000) end end addEventHandler("onClientGUIClick", root, pro2) And also are you sure you want to use setPlayerMoney not givePlayerMoney ? Resources I made: attachToBones - A newer bone_attach. Simple Level system - Just a simple level system. Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!
HUNGRY:3 Posted June 4, 2015 Author Posted June 4, 2015 Why don't you make it server side ?setPlayerMoney is a shared function so can be used server and also client. function pro2() if source == GUIEditor.button[2] then setPlayerMoney(localPlayer, 5000000) end end addEventHandler("onClientGUIClick", root, pro2) And also are you sure you want to use setPlayerMoney not givePlayerMoney ? i tried that but not working any ways thanks and it's ok for setplayermoney
TAPL Posted June 4, 2015 Posted June 4, 2015 That because the function don't require player element in client side, and anyway client side is not recommended.
ALw7sH Posted June 4, 2015 Posted June 4, 2015 Note: Using this function client side (not recommended) will not change a players money server side.
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