/ban command (rep) - 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: /ban command (rep) (
/showthread.php?tid=317641)
/ban command (rep) -
iPentagon - 12.02.2012
Hello I want an /ban command
That allows other admins to ban each other
example: /ban (playerid) (hours) (days) (reason)
And when the hours and day are up, the banned player gets unbanned.
Command please?
I'll Rep you.
Re: /ban command (rep) -
RicaNiel - 12.02.2012
do this
pawn Код:
CMD:ban(playerid,params[])
{
new id,time;
if(sscanf(params"uds[50]",id,time,params)) return SendClientMessage(playerid,0xFFFFFFAA,"< Usage > /ban [ name ] [ time / days ] [reason]");
if(!IsPlayerConnected(playerid,0xFFFFFFAA,"Player not connected");
{
// The rest will be made the script is too long
}
}
this is untested
Re: /ban command (rep) -
Nuke547 - 12.02.2012
PHP код:
command(ban, playerid, params[])
{
new id, reason[128], string[128];
if(sscanf(params, "uz", id, reason))
{
if(Player[playerid][AdminLevel] >= 2)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /ban [playerid] [reason]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 2)
{
if(IsPlayerConnectedEx(id))
{
if(Player[id][AdminLevel] >= Player[playerid][AdminLevel])
{
SendClientMessage(playerid, WHITE, "You do not have the authority to do that (higher rank, or the same).");
}
else
{
if(strlen(reason) >= 1)
{
new hour, minute, second, day, year, month;
gettime(hour, minute, second);
getdate(year, month, day);
format(string, sizeof(string), "You have been banned for %s.", reason);
SendClientMessage(id, GREY, string);
Ban(id);
}
else
{
SendClientMessage(playerid, WHITE, "SYNTAX: /ban [playerid] [reason]");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
return 1;
}
}
}
return 1;
}
Re: /ban command (rep) -
Dr.Heinz - 12.02.2012
you can also use like this
pawn Код:
if(id == INVALID_PLAYER_ID) //scanf support this.
instead of
pawn Код:
if(IsPlayerConnected(id))
Re: /ban command (rep) -
RicaNiel - 12.02.2012
oh yheaa i forgot