How to make a basic /pay command?
#4

pawn Код:
CMD:pay(playerid, params[])
{
    new Target, Amount;
    if( !sscanf(params, "ui", Target, Amount) )
    {
        if( Amount < 5 ) return SendClientMessage(playerid, -1, "Minimum amount: 5"); // if amount is lower as 5
        if( Target == INVALID_PLAYER_ID ) return SendClientMessage(playerid, -1, "Invalid playerid!"); // if target is an invalid playerid
        if( Target == playerid ) return SendClientMessage(playerid, -1, "You cant pay yourself."); // if youre the target
        if( GetPlayerMoney(playerid) < Amount ) return SendClientMessage(playerid, -1, "You dont have that amount of cash."); // if you dont have enough money you wanted to send to the player
        GivePlayerMoney(playerid, -Amount); // removing the money from you
        GivePlayerMoney(Target, Amount); // adding the money to you
       
    } else return SendClientMessage(playerid, -1, "Usage: /pay <playerid> <money>");
    return 1;
}
You just have to add the formats to send to the player.
Reply


Messages In This Thread
How to make a basic /pay command? - by rangerxxll - 16.10.2011, 10:02
Re: How to make a basic /pay command? - by SmiT - 16.10.2011, 10:06
Re: How to make a basic /pay command? - by Hiddos - 16.10.2011, 10:06
Re: How to make a basic /pay command? - by Wesley221 - 16.10.2011, 10:06
Re: How to make a basic /pay command? - by rangerxxll - 18.10.2011, 04:44

Forum Jump:


Users browsing this thread: 1 Guest(s)