How to set player money in MYSQL -
Zeus666 - 13.04.2018
Hi. How can I set playermoney in MYSQL ?
PHP код:
enum playerinfo
{
money
...
cache_get_field_content(0, "Money", tmp), pInfo[playerid][Money] = strval(tmp);
or how? Because if I do so, the GivePlayerMoney it won't work
Re: How to set player money in MYSQL -
Mugala - 13.04.2018
it's get, not set.
you have to use UPDATE function from MySQL
for example: (with MySQL R39)
PHP код:
new sqlquery[512],name[28];
GetPlayerName(playerid,name,28);
mysql_format(handle,sqlquery,512,"UPDATE `account` SET `Money` = '%d' WHERE `Name` = '%s'",GetPlayerMoney(playerid),name);
mysql_query(handle,query);
Re: How to set player money in MYSQL -
Zeus666 - 13.04.2018
Server Side Money or custom money?
Re: How to set player money in MYSQL -
Mugala - 13.04.2018
depends what you want to set. (probably server-sided)
P.S. you must set SQL table name and your decided params in this format. (copying this will not work)
Re: How to set player money in MYSQL -
Zeus666 - 13.04.2018
Quote:
Originally Posted by Mugala
depends what you want to set. (probably server-sided)
P.S. you must set SQL table name and your decided params in this format. (copying this will not work)
|
PHP код:
new Query[1100];
strcat(Query,"UPDATE `users` SET `Money` = '%i' WHERE `Username` = '%s'");
format(Query,sizeof(Query),Query,
pInfo[playerid][Money],
PlayerName(playerid));
mysql_tquery(handle, Query, "", "");
printf("%s", Query);
return 1;
}
Re: How to set player money in MYSQL -
Mugala - 13.04.2018
exactly! but I don't think that mysql_tquery is needed for this function, you're not using threaded queries here, just mysql_query will be enough.
Re: How to set player money in MYSQL -
Zeus666 - 13.04.2018
Quote:
Originally Posted by Mugala
exactly! but I don't think that mysql_tquery is needed for this function, you're not using threaded queries here, just mysql_query will be enough.
|
And, if I want to do
PHP код:
pInfo[playerid][Money] = -20;
it will set - 20. But how can I set to make it to set -20 OF current value?
Re: How to set player money in MYSQL -
Mugala - 13.04.2018
pInfo[playerid][Money] -= 20;
or pInfo[playerid][Money] += -20;
second one is funny.
Re: How to set player money in MYSQL -
Zeus666 - 13.04.2018
Quote:
Originally Posted by Mugala
pInfo[playerid][Money] -= 20;
or pInfo[playerid][Money] += -20; second one is funny.
|
Thank you, can someone hack mysql (With cheats, in game) and modify their money?
Re: How to set player money in MYSQL -
Mugala - 13.04.2018
of course not, it's your data, unless you don't share MySQL params (user,password)