26.10.2018, 21:49
Because you're using pCash wrong. Lemme do an example.
This should happen when player login: (Assuming you're using MySQL)
When giving money to a player, just use GivePlayerMoney.
If player quits and you wanna save their money, then:
Notice how i used GetPlayerMoney to get current player's money and saving them in "Cash" row.
To show them in /stats, you don't need to call pCash, just use GetPlayerMoney.
This should happen when player login: (Assuming you're using MySQL)
pawn Код:
cache_get_value_int(0, "Cash", PlayerInfo[playerid][pCash]);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
If player quits and you wanna save their money, then:
pawn Код:
new query[70], p = playerid;
mysql_format(g_SQL, query,sizeof(query), "UPDATE `your_players_table` SET `Cash` = %i WHERE `ID`= %d",
GetPlayerMoney(p) PlayerInfo[p][AccountID]);
mysql_query(g_SQL, query);
To show them in /stats, you don't need to call pCash, just use GetPlayerMoney.
pawn Код:
CMD:mymoney(playerid, params[])
{
new string[80];
format(string, sizeof(string), "I currently have $%i in my pocket.", GetPlayerMoney(playerid));
SendClientMessage(playerid,-1,string);
return 1;
}