Help: warn and /banwarn commands - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help: warn and /banwarn commands (
/showthread.php?tid=429702)
Help: warn and /banwarn commands -
Areax - 10.04.2013
Hello! (me again xD)
I have another question...
How can I make a /warn command and /banwarn command ? I mean, when u type /warn ID REASON, then it will give a player a warning (when he gets 3 warning, he will get kicked).
And for /banwarn it's will be the same, but he will get banned after 3 banwarnings...
Thanks for your help
Re: Help: warn and /banwarn commands -
PrezyI - 10.04.2013
pawn Код:
//On top of your script, under #includes
new playerWarn[MAX_PLAYERS];
//Bottom of your script
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
playerWarn[pID] ++;
GetPlayerName(playerid, pName, sizeof pName);
GetPlayername(pID, name, sizeof name);
format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]);
SendClientMessage(pID, -1, str);
format(str, sizoef str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]);
SendClientMessage(playerid, -1, str);
if(playerWarn[pID] > 2)
{
format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name);
SendClientMessageToAll(-1, str);
SendClientMessage(pID, -1, "You were warned three (3) times and got kicked.");
Kick(pID);
}
return 1;
}
You need ZCMD
Credits to antonio112.
You can also request a /banwarn at
https://sampforum.blast.hk/showthread.php?tid=413556
Re: Help: warn and /banwarn commands -
Areax - 11.04.2013
Quote:
Originally Posted by PrezyI
pawn Код:
//On top of your script, under #includes
new playerWarn[MAX_PLAYERS];
//Bottom of your script CMD:warn(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME]; if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, -1, "Selected player is not connected.");
playerWarn[pID] ++; GetPlayerName(playerid, pName, sizeof pName); GetPlayername(pID, name, sizeof name); format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]); SendClientMessage(pID, -1, str); format(str, sizoef str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]); SendClientMessage(playerid, -1, str); if(playerWarn[pID] > 2) { format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name); SendClientMessageToAll(-1, str); SendClientMessage(pID, -1, "You were warned three (3) times and got kicked."); Kick(pID); } return 1; }
You need ZCMD
Credits to antonio112.
You can also request a /banwarn at https://sampforum.blast.hk/showthread.php?tid=413556
|
Thanks, I made a /banwarn command now...