14.03.2011, 17:43
Quote:
Could someone script me the most easiet /pay command to transfer cash from one player to another, thank you
|
pawn Код:
CMD:pay(playerid, params[])
{
new tempname, temppay;
if( sscanf( params, "ui", tempname, temppay ) )
return SendClientMessage( playerid, -1,"Usage: /pay [PlayerID] [Amount]" );
if( tempname == playerid )
return SendClientMessage( playerid, -1,"You can't pay to yourself." );
if( GetPlayerMoney( playerid ) < temppay )
return SendClientMessage( playerid, -1, "You don`t have that much." );
new Float:dpX, Float:dpY, Float:dpZ;
GetPlayerPos( tempname, dpX, dpY, dpZ );
if ( !IsPlayerInRangeOfPoint( playerid, 3, dpX, dpY, dpZ ) )
return SendClientMessage( playerid, -1, "This player is not near you." );
GivePlayerMoney( tempname, temppay);
GivePlayerMoney( playerid, - temppay );
return 1;
}