SA-MP Forums Archive
mysql zcmd ban and unban command - 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: mysql zcmd ban and unban command (/showthread.php?tid=347359)



mysql zcmd ban and unban command - sanrock - 01.06.2012

How do I make a ban and unban mysql zcmd command?


Re: mysql zcmd ban and unban command - Sandiel - 01.06.2012

On top of your script
Код:
 new IsPlayerBanned[MAX_PLAYERS] = 0;
here's the command
Код:
COMMAND:ban(playerid, params[])
{
	new pID, reason[64];
	if(!sscanf(params, "us", pID, reason))
	{
	    if(PlayerInfo[playerid][pAdmin] >= 1)
		{
		    if(PlayerInfo[playerid][pAdminDuty] == 1)
		    {
			    new string[128];
			    new adminname[MAX_PLAYER_NAME];
			    new playername[MAX_PLAYER_NAME];

			    GetPlayerName(playerid, adminname, sizeof(adminname));
			    GetPlayerName(pID, playername, sizeof(playername));

				format(string, sizeof(string), "AdmCmd: %s has been banned by %s, Reason:%s", playername, adminname, reason);
				SendClientMessageToAll(COLOR_RED, string);
				Ban(pID);
                                IsPlayerBanned[playerid] = 1;
			}
			else return SendClientMessage(playerid, COLOR_GREY, "You need to be on admin duty in order to use this feature (/aduty)");
		}
		else return SendClientMessage(playerid, COLOR_GREY, ".:: You are not authorised to use this command ::.");
	}
	else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [PlayerID/PartOfName] [Reason]");
	return 1;
}
Same concept applies for the unban command.