Annas Posted December 25, 2015 Share Posted December 25, 2015 How can i take player money when he is offline? i dont know if there is a function named Take Account Money or something like that i just wanna take a player money from his account when he is offline.. please help me , and thx. Link to comment
AMARANT Posted December 25, 2015 Share Posted December 25, 2015 setAccountData getAccountData Or functions for working with databases. Link to comment
Annas Posted December 25, 2015 Author Share Posted December 25, 2015 the money data name: money can anyone state the client or server side script please? i need it with command handler I will show you my exemple , but i wanna fixed one ; and one working.. Wish you understand.. function something(player) local amount = getaccountdata(player, "money") if player(player=who will type the command) in team named "Staff" then setAccountData(player, ..amount.., -THEMONEY) end addcommandhandler("setmoney", something) the command must be (./takemoney ACCOUNT AMOUNT) Link to comment
AMARANT Posted December 25, 2015 Share Posted December 25, 2015 I understand what you want but you should do it by yourself because there is some stuff which should be set already on your server (like stored player team, money, etc.). You can set it with the functions I meant above. Moreover on the wiki page of those functions there is an example of storing a player's money. Link to comment
Annas Posted December 25, 2015 Author Share Posted December 25, 2015 Ok , this is good exemple, and 100% will be working function something(player) local amount = getaccountdata(player, "money") if player(player=who will type the command) in team named "Staff" then setAccountData(player, ..amount.., -THEMONEY) end addcommandhandler("setmoney", something) (i know , i'll replace the team and others..) but what about (-TheMoney) , i wont set money to him i wanna take from him the money.. oh , wait .. takePlayerMoney(player, amount) i can make it local acc = getaccountdata(player, "money") takePlayerMoney(acc, amount) ? , it will work if he is offline right? Link to comment
AMARANT Posted December 25, 2015 Share Posted December 25, 2015 I can tell you that you should get player account at first. Then you have to retrieve the data you need. And after that you can set it to whatever you want. And yes, it will work offline. This is a simple example: local account = getAccount("NAME_OF_THE_ACCOUNT") local money = getAccountData(account,"NAME_OF_THE_DATA") local newmoney = tonumber(money)-5000 setAccountData(account,newmoney) Link to comment
Annas Posted December 25, 2015 Author Share Posted December 25, 2015 Fully code please, i do not understand anything! command : /takemoney ACCname AMOUNT please understand and help me ,kiss your hands! Link to comment
Noki Posted December 25, 2015 Share Posted December 25, 2015 We don't write code for you here. AMARANT already gave you an example. You seem to have already wrote part of your desired code anyway in your previous posts. Link to comment
Tekken Posted December 26, 2015 Share Posted December 26, 2015 addCommandHandler("takeaccmoney", function(player, cmd, account, moneyToTake) if isObjectInACLGroup("user."..getAccountName(player), aclGetGroup("Admin")) then local acc = getAccount(tostring(account)); if (acc) then setAccountData(acc, "YOUR.KEY", getAccountData(acc, "YOUR.KEY")-tonumber(moneyToTake)); outputChatBox("Done!", player, 0, 255, 2); end end end); Replace "YOUR.KEY"! 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