CMD:warn(playerid, params[]) { new PlayerToKick; new iPlayer, szReason[ 128 ] ; if (APlayerData[playerid][PlayerLevel] >= 1) if( sscanf( params, "iS(None specified)[128]", iPlayer, szReason )) return SendClientMessage( playerid, 0xFF0000AA, "[USAGE] /warn [playerid] [reason]" ); g_iWarnings[ iPlayer ] ++; if( g_iWarnings[ iPlayer ] > 2 ) // 3 warnings { // Kick player or whatever you want (and send messages) Kick(PlayerToKick); } else // 1 or 2 warnings { new iName[ MAX_PLAYER_NAME ] ; GetPlayerName( playerid, iName, MAX_PLAYER_NAME ); format( szReason, sizeof( szReason ), "%s has been warned by admin %s (%i/3)%s%s", iName,FormatName(playerid), g_iWarnings[ iPlayer ], ( isnull( szReason ) ? ("") : (" - Reason: ") ), szReason ); SendClientMessageToAll( 0xFFFF00FF, szReason ); } return true; }
CMD:warn(playerid, params[])
{
new PlayerToKick;
new
iPlayer,
szReason[ 128 ]
;
if (APlayerData[playerid][PlayerLevel] >= 1)
if( sscanf( params, "iS(None specified)[128]", iPlayer, szReason ))
return SendClientMessage( playerid, 0xFF0000AA, "[USAGE] /warn [playerid] [reason]" );
g_iWarnings[ iPlayer ] ++;
if( g_iWarnings[ iPlayer ] > 2 ) // 3 warnings
{
// Kick player or whatever you want (and send messages)
Kick(PlayerToKick);
}
else // 1 or 2 warnings
{
new
iName[ MAX_PLAYER_NAME ]
;
GetPlayerName( iPlayer, iName, MAX_PLAYER_NAME ); // Here is the error tapeworms playerid instead of iPlayer
format( szReason, sizeof( szReason ), "%s has been warned by admin %s (%i/3)%s%s", iName,FormatName(playerid), g_iWarnings[ iPlayer ], ( isnull( szReason ) ? ("") : (" - Reason: ") ), szReason );
SendClientMessageToAll( 0xFFFF00FF, szReason );
}
return true;
}
PHP код:
|
cesar, can I use this code in any FS or I need some extra thing? Yes the #include <sscanf2> I know but anything else?
|
if (APlayerData[playerid][PlayerLevel] >= 1)
pawn Код:
pawn Код:
|