13.05.2012, 14:13
Quote:
Hello I want Make /warn command But i fail more than one time , so can any one help me and make me one ?
|
pawn Код:
#include <a_samp>
#include < zcmd >
#include < sscanf2 >
#define COLOR_GREEN 0x33AA33AA
#define RED 0xE60000AA
CMD:warn(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "us", params[ 0 ],params[ 1 ]) )return SendUsage( playerid, "/warn <id> [reason]" );
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!");
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
if( params[ 0 ] == playerid )return SendError( playerid, "Why would you want to warn yourself?Did you do something?");
++P_DATA[ params[ 0 ] ][ P_Warns ];
if( P_DATA[ params[ 0 ] ][ P_Warns ] < P_MAX_WARNS)
{
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has givin a warning to %s! [Warn:%d/%d] [Reason: %s]",PlayerName2( playerid ), PlayerName2( params[ 0 ] ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS,params[ 1 ]);
FormMessage( params[ 0 ], COLOR_RED, "Administrator %s has warned you ! Dont make him to ban you [Warn:%d/%d] [Reason: %s]",PlayerName2( playerid ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS, params[ 1 ]);
FormMessage( playerid, COLOR_GREEN, "You have warned %s! [Warn:%d/%d] [Reason: %s]",PlayerName2( params[ 0 ] ),P_DATA[ params[ 0 ] ][ P_Warns ],P_MAX_WARNS,params[ 1 ]);
}
else if( P_DATA[ params[ 0 ] ][ P_Warns ] == P_MAX_WARNS )
{
FormMessageForAllEx(params[ 0 ],COLOR_GREEN, "%s has been kicked by the system! [Reason: Exceeding Warnings]",PlayerName2( params[ 0 ] ));
FormMessage( params[ 0 ], COLOR_GREEN, "You have been kicked by the system! [Reason: Exceeding Warnings]",0);
Kick( params[ 0 ] );
}
return 1;
}