1
mIRC/pawn Scripting / Re: Help?With Slap Command?
« on: February 15, 2012, 04:07:24 pm »
Anyway 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
{
new Float:x, Float:y, Float:z;
GetPlayerPos( plr, x, y, z );
SetPlayerPos( plr, x+3, y+3, z+3, 0, 0 );
format( szMsg, sizeof( szMsg ), "Admin %s slaped player:[ %s ] Reason:[ %s ]", gPlayers[ playerid ], gPlayers[ plr ], cmdtext[ strlen( tmp ) +6 ] );
SendClientMessageToAll( COLOR_GREEN, szMsg );
SetPlayerDrunk(playerid, 300, 300);
}
return 1;[/pawn]
[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
{
new Float:x, Float:y, Float:z;
GetPlayerPos( plr, x, y, z );
SetPlayerPos( plr, x+3, y+3, z+3, 0, 0 );
format( szMsg, sizeof( szMsg ), "Admin %s slaped player:[ %s ] Reason:[ %s ]", gPlayers[ playerid ], gPlayers[ plr ], cmdtext[ strlen( tmp ) +6 ] );
SendClientMessageToAll( COLOR_GREEN, szMsg );
SetPlayerDrunk(playerid, 300, 300);
}
return 1;[/pawn]