Mefisto_PL Posted November 3, 2012 Share Posted November 3, 2012 I've made a Money System.. When I quit or logout my cash is saved.. But when I have for example $666 and when I use takePlayerMoney ( blah blah blah 500 for example ) then I have $166, when I quit I have $666.. WHY?! Link to comment
Castillo Posted November 3, 2012 Share Posted November 3, 2012 You are taking it client side? Link to comment
theDavid Posted November 3, 2012 Share Posted November 3, 2012 Where you save your data? Link to comment
Mefisto_PL Posted November 4, 2012 Author Share Posted November 4, 2012 You are taking it client side? Yup. Where you save your data? Did you see any code here? I save my data in server-side script.. Link to comment
DiSaMe Posted November 4, 2012 Share Posted November 4, 2012 setPlayerMoney/givePlayerMoney/takePlayerMoney: Note: Using this function client side (not recommended) will not change a players money server side. Link to comment
Mefisto_PL Posted November 12, 2012 Author Share Posted November 12, 2012 So how I must use it? Link to comment
Cadu12 Posted November 12, 2012 Share Posted November 12, 2012 Just change client-side to server-side. Link to comment
Mefisto_PL Posted November 13, 2012 Author Share Posted November 13, 2012 Using triggerServerEvent ? Link to comment
myonlake Posted November 14, 2012 Share Posted November 14, 2012 Using triggerServerEvent ? If you really have to keep your code client-side, then yes, use triggerServerEvent. If you can do the same code server-side, then do it server-side. Link to comment
Cadu12 Posted November 14, 2012 Share Posted November 14, 2012 Using triggerServerEvent for setPlayerMoney/givePlayerMoney/takePlayerMoney It is BAD idea, because hacker is able to set money. Link to comment
Mefisto_PL Posted November 15, 2012 Author Share Posted November 15, 2012 So what I must use in your opinion ? Link to comment
Mefisto_PL Posted November 17, 2012 Author Share Posted November 17, 2012 Sorry for Off-Topic, but still I have this problem.. Link to comment
Castillo Posted November 17, 2012 Share Posted November 17, 2012 What problem? money problem? Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 (edited) We gave you 100 examples and you haven't understood a single one of them? Give us a break. Test the money function by typing /ctest in-game. You should lose $100.00 and when you logout/quit the game, it will save your money. When you log in, it will return back your money. This is just an example, you must understand the code and please take time to read and understand it. Client-side addCommandHandler("ctest", function(cmd) triggerServerEvent("onMoneyTaken", localPlayer) end ) Server-side addEventHandler("onPlayerQuit", root, function(quitType, reason, responsibleElement) if isGuestAccount(getPlayerAccount(source)) then return end setAccountData(getPlayerAccount(source), "player:money", getPlayerMoney(source)) end ) addEventHandler("onPlayerLogout", root, function(previousAccount, currentAccount) if isGuestAccount(getPlayerAccount(source)) then return end setAccountData(getPlayerAccount(source), "player:money", getPlayerMoney(source)) end ) addEventHandler("onPlayerLogin", root, function(previousAccount, currentAccount, autoLogin) if getAccountData(currentAccount, "player:money") then setPlayerMoney(source, tonumber(getAccountData(currentAccount, "player:money"))) else setPlayerMoney(source, 200) end end ) addEvent("onMoneyTaken", true) addEventHandler("onMoneyTaken", root, function() takePlayerMoney(source, 100) end ) Edited November 17, 2012 by Guest Link to comment
Mefisto_PL Posted November 17, 2012 Author Share Posted November 17, 2012 Cadu12 Wrote that is easy to hack for hackers.. but I forget about hacks isn't allowed in MTA ;x ( I know this way, and I want to use that, I understand it ) ///EDIT In server-side isn't "addEvent" function and only that I don't understand. Link to comment
myonlake Posted November 17, 2012 Share Posted November 17, 2012 Copy the code again then... Link to comment
Mefisto_PL Posted November 17, 2012 Author Share Posted November 17, 2012 I see.. don't be nervous . 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