16.10.2011, 10:06
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;
}