SA-MP Forums Archive
Help with GetPlayerMoney. - 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: Help with GetPlayerMoney. (/showthread.php?tid=362835)



Help with GetPlayerMoney. - TaLhA XIV - 25.07.2012

Hello!
I wanted to ask that how to get the players money and display it buy a Client message.Like if I do /mymoney it display my money through a client message.I need it for a function.Help would be appreciated.
Thank you.


Re: Help with GetPlayerMoney. - [IKS]Niko_Hs™ - 25.07.2012

What do you use strcmp or zcmd or ycmd or other? (as a command processor)


Re: Help with GetPlayerMoney. - TaLhA XIV - 25.07.2012

I use strcmp.((Not a pro scripter))


Re: Help with GetPlayerMoney. - [IKS]Niko_Hs™ - 25.07.2012

Use sscanf or Strtok ?

EDIT : sorry, I misunderstood, I thought the cmd was getcash id.. try this cmd :

Код:
if (strcmp("/mymoney", cmdtext, true, 8) == 0)
{
new money;
new stringy[256]; 
money = GetPlayerMoney(playerid); 
format(stringy, sizeof(stringy), "[INFO-MONEY]: You have $%d", money); 
SendClientMessage(playerid, COLOR, stringy); 
return 1;
}



Re: Help with GetPlayerMoney. - TaLhA XIV - 25.07.2012

sorry for the double post but please help I need it urgent,please.


Re: Help with GetPlayerMoney. - CentyPoo - 25.07.2012

pawn Код:
if (strcmp("/mymoney", cmdtext, true, 8) == 0)
    {
        new string[128]; //creates the string to set the message for the player
        new money; //creates the var for the player's money
        money = GetPlayerMoney(playerid); //sets money as the player's current money
        format(string, sizeof(string), "You currently have $%d", money); //sets the message for the player
        SendClientMessage(playerid, -1, string); //sends the message
        return 1;
    }
You could use something as simple as this. If that's what you meant.