How to get player money from SQL?
#1

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.
Reply
#2

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...
Reply
#3

PHP код:
SELECT money FROM players WHERE id=%
Check docs.
Reply
#4

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' 
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)