/warn -
Markx - 13.03.2011
Can someone make a warn system with /warn [id] [reason] and /removewarn [id] [reason] please!
If yes, in Zcmd
Im using:
pawn Код:
if(PVar[playerid][pLevel] >= 2) //level 2 admin
Re: /warn -
antonio112 - 13.03.2011
Made it for you. For the GetPlayerName( playerid ) bla bla, you can do that. For the moment it`ll be "Admin ID (of the admin) in the text.
pawn Код:
CMD:warn( playerid, params[ ] )
{
if(PVar[playerid][pLevel] < 2) //level 2 admin
return SendClientMessage( playerid, -1, "Only admins level 2+ can use this command."
new tempname, temptext[ 128 ];
if ( sscanf( params, "us[128]", tempname, temptext ) )
return SendClientMessage( playerid, -1, "Usage: /warn <PlayerID> [Reason]");
if ( !IsPlayerConnected( tempname ) )
return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt( tempname, "Warnings", GetPVarInt( tempname, "Warnings") + 1 );
new String[ 256 ];
format( String, sizeof( String ), "Admin %s warned player %s for: %s",
playerid,
tempname,
temptext );
SendClientMessageToAll( -1, String );
if( GetPVarInt( tempname, "Warnings" ) == 3 )
{
format( String, sizeof ( String ), "Player %s got autobanned for earning 3 warnings.", pName( tempname ) );
SendClientMessageToAll( -1, String );
SendClientMessage( tempname, -1, "You've been banned for 3 warnings." );
BanEx( tempname, "3 Warnings" );
}
return 1;
}
And for unwarn:
pawn Код:
CMD:unwarn( playerid, params[ ] )
{
if(PVar[playerid][pLevel] < 2) //level 2 admin
return SendClientMessage( playerid, -1, "Only admins level 2+ can use this command."
new tempname, temptext[ 128 ]
if ( sscanf( params, "us[128]", tempname, temptext ) )
return SendClientMessage( playerid, -1, "Usage: /unwarn <PlayerID> [reason]");
if ( !IsPlayerConnected( tempname ) )
return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt( tempname, "Warnings", GetPVarInt( tempname, "Warnings") - 1 );
new String[ 50 ];
format( String, sizeof( String ), "Admin %u unwarned you.", playerid );
SendClientMessage( tempname, -1, String );
format( String, sizeof( String ), "You unwarned player %u for %s.", tempname, temptext );
SendClientMessage( playerid, -1, String );
return 1;
}
And if you want to save the warnings, you'll have to work that on your own.
Re: /warn -
Markx - 13.03.2011
Quote:
Originally Posted by antonio112
Made it for you. For the GetPlayerName( playerid ) bla bla, you can do that. For the moment it`ll be "Admin ID (of the admin) in the text.
pawn Код:
CMD:warn( playerid, params[ ] ) { if(PVar[playerid][pLevel] < 2) //level 2 admin return SendClientMessage( playerid, -1, "Only admins level 2+ can use this command." new tempname, temptext[ 128 ]; if ( sscanf( params, "us[128]", tempname, temptext ) ) return SendClientMessage( playerid, -1, "Usage: /warn <PlayerID> [Reason]");
if ( !IsPlayerConnected( tempname ) ) return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt( tempname, "Warnings", GetPVarInt( tempname, "Warnings") + 1 ); new String[ 256 ]; format( String, sizeof( String ), "Admin %s warned player %s for: %s", playerid, tempname, temptext );
SendClientMessageToAll( -1, String );
if( GetPVarInt( tempname, "Warnings" ) == 3 ) { format( String, sizeof ( String ), "Player %s got autobanned for earning 3 warnings.", pName( tempname ) ); SendClientMessageToAll( -1, String ); SendClientMessage( tempname, -1, "You've been banned for 3 warnings." ); BanEx( tempname, "3 Warnings" ); } return 1; }
And for unwarn:
pawn Код:
CMD:unwarn( playerid, params[ ] ) { if(PVar[playerid][pLevel] < 2) //level 2 admin return SendClientMessage( playerid, -1, "Only admins level 2+ can use this command." new tempname, temptext[ 128 ] if ( sscanf( params, "us[128]", tempname, temptext ) ) return SendClientMessage( playerid, -1, "Usage: /unwarn <PlayerID> [reason]");
if ( !IsPlayerConnected( tempname ) ) return SendClientMessage( playerid, -1, "Player is not connected.");
SetPVarInt( tempname, "Warnings", GetPVarInt( tempname, "Warnings") - 1 ); new String[ 50 ]; format( String, sizeof( String ), "Admin %u unwarned you.", playerid ); SendClientMessage( tempname, -1, String ); format( String, sizeof( String ), "You unwarned player %u for %s.", tempname, temptext ); SendClientMessage( playerid, -1, String ); return 1; }
And if you want to save the warnings, you'll have to work that on your own.
|
Thanks!
Re: /warn -
alpha500delta - 13.03.2011
Wooooooo change your strings to 128
Re: /warn -
antonio112 - 13.03.2011
You're welcome ... if you find any bugs or errors in the command, don`t hesitate to post here, since I did it in 3 minutes and didn`t really checked it out.
Re: /warn -
ricardo178 - 13.03.2011
1 think.... See if your register/login system(account registration and save) save warmnings..... If not you will need to add! Or when player relog he get 0 warmnings... Am i wrong?
Re: /warn -
antonio112 - 13.03.2011
No, you're completely right ... but as I mentioned above, I have no idea what kind of saving system he uses, so I can`t help him in that matter.
Re: /warn -
ricardo178 - 13.03.2011
I was afraid of say shit...
Let's just wait for his answer...
Re: /warn -
Markx - 15.03.2011
Hmm its a bit bugged, im level 6 admin but it says that only level 2+ admins can use it Lol, i tryd to make me level 2 and its still the same :P
Re: /warn -
antonio112 - 15.03.2011
There`s no way to happen that .. only if you didn`t change something in the command. Give me your command.