25.09.2013, 15:52
Doing the same thing. Getting the name from the player the playerid typed and check it with strcmp (Remember, if it returns 0 - both strings (names) are same).
pawn Код:
CMD:sethealth( playerid, params[ ] )
{
new
id,
Float: health
;
if( sscanf( params, "rf", id, health ) ) return SendClientMessage( playerid, -1, "Usage: /sethealth <ID/Part Of Name> <health>" );
if( id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Offline player" );
new
_name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, _name, MAX_PLAYER_NAME );
if( !strcmp( _name, "Fernado", true ) )
{
GetPlayerName( id, _name, MAX_PLAYER_NAME );
if( !strcmp( _name, "Samuel", true ) ) SetPlayerHealth( id, health );
else SendClientMessage( playerid, -1, "You can use this command only to Samuel!" );
}
else SendClientMessage( playerid, -1, "Only Fernado can use this command!" );
return 1;
}