27.06.2011, 08:39
pawn Код:
SendClientMessage(id, 0xFFF00AA, "Admin %s gave you %i", playerid, amount);
pawn Код:
format( string, sizeof string, "Admin %s gave you %i.", GetName( playerid ), amount );
SendClientMessage( id, 0xFFFF00AA, string );
pawn Код:
format(string, sizeof(string), "You gave %s $ to %i.", amount, GetName(id));
integer = playername
?
pawn Код:
format( string, sizeof string, "You gave $%i to %s.", amount, GetName(id));
Also? Why do you use 256 on string? :S
String in sscanf for player name ? xD
Rewritten /givecash
pawn Код:
dcmd_givecash( playerid, params[ ] )
{
if ( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, 0xAA0000AA, "Error: Not an admin." );
new targetid, amount;
if ( sscanf( params, "ud", targetid, amount ) ) return SendClientMessage( playerid, 0xAA0000AA, "Error: /givecash < playerid / partofname > < amount >" );
if ( targetid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, 0xAA0000AA, "Error: Invalid player." );
if ( amount < 0 ) return SendClientMessage( playerid, 0xAA0000AA, "Error: Invalid amount." );
new string[ 128 ];
format( string, sizeof string, "Admin %s gave you $%d.", GetName( playerid ), amount );
SendClientMessage( playerid, 0xAA0000AA, string );
format( string, sizeof string, "You gave $%d to %s.", amount, GetName( targetid ) );
SendClientMessage( targetid, 0xAA0000AA, string );
GivePlayerMoney( targetid, amount );
return 1;