How to get player money from SQL? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to get player money from SQL? (
/showthread.php?tid=629954)
How to get player money from SQL? -
DuyDang2412 - 06.03.2017
Yeah, like the title. I don't know how to get the player money from SQL so that I can give the player money offline.
Re: How to get player money from SQL? -
JessThompson - 06.03.2017
You will need to provide:
Enum for playerdata
saving system for player data
and tell us how you provide money already like is there anticheat or...
Re: How to get player money from SQL? -
amirm3hdi - 06.03.2017
PHP код:
SELECT money FROM players WHERE id=%i
Check docs.
Re: How to get player money from SQL? -
PowerPC603 - 07.03.2017
If you just want to give a player some money, you don't need to know the money he has upfront.
PHP код:
UPDATE playerdata SET Money = Money + '%i' WHERE UserID = '%i'
Such a query gets the specified player's money and adds the given money to it, whatever money the player already has.
You may want to use a playername instead of a UserID to reference the correct player offline:
PHP код:
UPDATE playerdata SET Money = Money + '%i' WHERE PlayerName = '%e'
Re: How to get player money from SQL? -
amirm3hdi - 25.04.2017
Quote:
Originally Posted by PowerPC603
If you just want to give a player some money, you don't need to know the money he has upfront.
PHP код:
UPDATE playerdata SET Money = Money + '%i' WHERE UserID = '%i'
Such a query gets the specified player's money and adds the given money to it, whatever money the player already has.
You may want to use a playername instead of a UserID to reference the correct player offline:
PHP код:
UPDATE playerdata SET Money = Money + '%i' WHERE PlayerName = '%e'
|
Nice but adding money like that is only useful when player is offline.