Money update
#4

Because you're using pCash wrong. Lemme do an example.

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]);
When giving money to a player, just use GivePlayerMoney.

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);
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.

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;
}
Reply


Messages In This Thread
Money update - by Calinut200 - 26.10.2018, 21:29
Re: Money update - by KinderClans - 26.10.2018, 21:36
Re: Money update - by Calinut200 - 26.10.2018, 21:43
Re: Money update - by KinderClans - 26.10.2018, 21:49
Re: Money update - by Calinut200 - 26.10.2018, 21:55
Re: Money update - by KinderClans - 26.10.2018, 21:56
Re: Money update - by Calinut200 - 26.10.2018, 22:32
Re: Money update - by kristo - 27.10.2018, 00:49
Re: Money update - by KinderClans - 27.10.2018, 01:00
Re: Money update - by kristo - 27.10.2018, 01:38

Forum Jump:


Users browsing this thread: 1 Guest(s)