Reggae Posted August 4, 2015 Share Posted August 4, 2015 Dont work help-me Client: function funcao () triggerServerEvent ( "itens", resourceRoot ) guiSetVisible ( window, false ) showCursor ( false ) end Server: function desert () if takePlayerMoney ( root, tonumber(500) ) then local currentgivem4 = getElementData(client, "M4") or 0 setElementData(client, "M4",currentgivem4+1) else outputChatBox("pobre") end end addEvent( "itens", true ) addEventHandler( "itens", getRootElement(), desert ) Link to comment
LabiVila Posted August 4, 2015 Share Posted August 4, 2015 Can you post whole client-side script? And whats' debugscript saying? Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 Full code would be really useful as LabiVila said. However, if you want to take money from specific player, you must pass a player through triggerServerEvent. triggerServerEvent("itens", localPlayer) And to get player server side, use source. takePlayerMoney(source, 500) -- You don't need tonumber here. local currentgivem4 = getElementData(source, "M4") or 0 setElementData(source, "M4", currentgivem4+1) Link to comment
Reggae Posted August 4, 2015 Author Share Posted August 4, 2015 When the player has 0 cash and purchase the item below .. He gets -500 What do I do to not cash their money? Link to comment
LabiVila Posted August 4, 2015 Share Posted August 4, 2015 if getPlayerMoney (source) > 500 then takePlayerMoney (source, 500) else outputChatBox ("No enough money", source) end Link to comment
MAB Posted August 5, 2015 Share Posted August 5, 2015 it is >= not just > because the player may have 500$ so right code is : if getPlayerMoney (source) >= 500 then takePlayerMoney (source, 500) else outputChatBox ("No enough money", source) end Link to comment
lolman Posted August 5, 2015 Share Posted August 5, 2015 it is >= not just > because the player may have 500$ so right code is : if getPlayerMoney (source) >= 500 then takePlayerMoney (source, 500) else outputChatBox ("No enough money", source) end Doesn't matter, it still works (tested it more then 100000 times and still works by using > instead of >=) Link to comment
LabiVila Posted August 5, 2015 Share Posted August 5, 2015 Sorry for going off topic @michaleamir but once he understands how it works, then he can easily manipulate with such stuff 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