How to make a basic /pay command?
#2

pawn Код:
CMD:pay(playerid, params[])
{
    new P_NAME[ MAX_PLAYER_NAME ], T_NAME[ MAX_PLAYER_NAME ], sZ[ 128 ];
    if( sscanf ( params, "ui", params[ 0 ], params[ 1 ] ) ) return SendClientMessage( playerid -1, #Syntax /pay name ammount );
    if( params[ 0 ] == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, #Player offline );
    if( params[ 1 ] > GetPlayerMoney ( playerid ) ) return SendClientMessage( playerid, -1, #Invalid ammount );
    GetPlayerName( playerid, P_NAME, MAX_PLAYER_NAME ); GetPlayerName( params[ 0 ], T_NAME, MAX_PLAYER_NAME );
    format( sZ, sizeof ( sZ ), "You have received $%d from %s ", params[ 1 ], P_NAME );
    SendClientMessage( params[ 0 ], sZ );
    format( sZ, sizeof ( sZ ), "You have payed $%d to %s ", params[ 1 ], T_NAME );
    SendClientMessage( playerid, sZ );
    GivePlayerMoney ( playerid, - params[ 1 ] );
    GivePlayerMoney ( params[ 0 ], params[ 1 ] );
    return true;
}
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)