Take this
[pawn] else if ( strcmp( cmd, "slap", true ) == 0 )
{
new reason[ 256 ], plr, szMsg[ 128 ];
tmp = strtok( cmdtext, idx ), reason = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
else if ( !strlen(reason) ) SendClientMessage( playerid, COLOR_RED, "USAGE: /c slap [Nick/ID] [Reason]" );
else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
else
{
format( szMsg, sizeof( szMsg ), "Admin %s Slap player:[ %s ] Reason:[ %s ]", gPlayers[ playerid ], gPlayers[ plr ], cmdtext[ strlen( tmp ) +6 ] );
SendClientMessageToAll( COLOR_GREEN, szMsg );
new Float:x,Float:y,Float:z,Float:health;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+5);
health = GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health - 23);
SetPlayerDrunk(plr,500 );
SendClientMessage(plr,GREEN,"You Have Been Slapped By An Admin,Respawn To Get Rid Of It");
}
return 1;
}[/pawn]