SA-MP Forums Archive
%S mONEY - 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: %S mONEY (/showthread.php?tid=328140)



%S mONEY - Gooday - 23.03.2012

Hello, I would like to make a script /take ID mONEY so i just need to know how to set the %s of the money.

+REP!


Re: %S mONEY - antonio112 - 23.03.2012

pawn Код:
YCMD:take(playerid, params[], help)
{
    #pragma unused help
    new pID, pAmmount, str[70];

    if(sscanf(params, "ui", pID, pAmmount))
        return SendClientMessage(playerid, -1, "Usage: /take [PlayerID / Name] [Amount]");

    if(pAmmount < 0)
        return SendClientMessage(playerid, -1, "Error: Invalid amount. Use positive values only..");
           
    format(str, sizeof str, "You took %i$ from %s.", pAmount, pName(pID));
    SendClientMessage(playerid, -1, str);
    format(str, sizeof str, "%s took %i from you.", pName(playerid), pAmount);
    SendClientMessage(pID, -1, str);
    GivePlayerMoney(pID, -pAmount);
    GivePlayerMoney(playerid, pAmount);
    return 1;
}
stock pName(playerid)
{
        new Name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, sizeof Name);
        return Name;
}