/pay command help
#4

try this using sscanf 2.0, very simple
https://sampforum.blast.hk/showthread.php?tid=120356

Quote:
Originally Posted by SA-MP Wiki
Strtok

Note: This function is deprecated and use of it should be avoided where possible.
Better alternatives like sscanf are available for you to use.
pawn Код:
if(strcmp(cmd, "/pay", true) == 0)
{
    new reciever, money;
    if (sscanf(params, "dd", reciever, money)) SendClientMessage(playerid, COLOR_WHITE, "Usage: /pay [playerid] [amount]");
    else
    {
        if(GetPlayerMoney(playerid) < money)
        {
            SendClientMessage(playerid, COLOR_GREY, "You don't have that much!");
            return 1;
        }
        new string[64], playername[MAX_PLAYER_NAME], playername2[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerName(reciever, playername2, sizeof(playername2));
        format(string, sizeof(string), "You recieved &%d from %s.", money, playername);
        SendClientMessage(playerid, COLOR_GREY, string);
        format(string, sizeof(string), "You gave &%d to %s.", money, playername);
        SendClientMessage(playerid, COLOR_GREY, string);
        GivePlayerMoney(playerid, GetPlayerMoney(playerid) - money);
        GivePlayerMoney(reciever, GetPlayerMoney(reciever) + money);
        return 1;
    }
}
Reply


Messages In This Thread
/pay command help - by ReneG - 05.01.2012, 04:05
Re: /pay command help - by coole210 - 05.01.2012, 04:14
Re: /pay command help - by [O.z]Caroline - 05.01.2012, 04:23
Respuesta: /pay command help - by Vladeksh - 05.01.2012, 04:42
Re: /pay command help - by ReneG - 05.01.2012, 22:43

Forum Jump:


Users browsing this thread: 2 Guest(s)