SA-MP Forums Archive
Ban 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: Ban command. (/showthread.php?tid=418099)



Ban command. - NathNathii - 23.02.2013

// FIXED!


Re: Ban command. - NathNathii - 23.02.2013

Forgot to post this
Код:
C:\Users\\Documents\GT Testing\pawno\include\PlayerCommands.inc(7) : warning 202: number of arguments does not match definition
The only warning i get.


Re: Ban command. - SilverKiller - 23.02.2013

Quote:
Originally Posted by NathNathii
Посмотреть сообщение
Код:
C:\Users\\Documents\GT Testing\pawno\include\PlayerCommands.inc(7) : warning 202: number of arguments does not match definition
The only warning i get.
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF000000, "You must be an admin to use this command!");



Re: Ban command. - NathNathii - 23.02.2013

I want it to work for people with admin level 3 not only for rcon please.


Re: Ban command. - UnknownGamer - 23.02.2013

Quote:
Originally Posted by NathNathii
Посмотреть сообщение
Hello again.
Thanks to the guy who scripted this command for me, but when i try to use it in-game it says
SERVER: Unknown Command(and makes space in the chat)

Код:
CMD:ban(playerid, params[])
{
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF000000); 
   new pID, reason[128], playerName[MAX_PLAYER_NAME], adminName[MAX_PLAYER_NAME];
   if(sscanf(params, "rs[128]", pID, reason)) return SendClientMessage(playerid, 0xFF000000, "USAGE: /ban [id] [reason]");
   if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF000000, "This player is not connected.");
   if(pID == playerid) return SendClientMessage(playerid, 0xFF000000, "You cannot ban yourself.");
   new string[128];
   SendClientMessage(pID, 0xFF000000, "You have been banned from this server!");
   format(string, sizeof string, "Reason: %s", reason);
   SendClientMessage(pID, 0xFF000000, string);
   GetPlayerName(playerid, adminName, sizeof adminName);
   format(string, sizeof string, "Admin: %s", adminName);
   SendClientMessage(pID, 0xFF000000, string);
   SendClientMessage(pID, 0xFF000000, "If you think this is an unfair ban, create ban appeal at www.GranTrucking.com");
   BanEx(pID, reason);
   GetPlayerName(playerid, playerName, sizeof playerName);
   format(string, sizeof string, "Admin %s has banned %s. (Reason: %s)", adminName, playerName, reason);
   SendClientMessageToAll(0xFF0000AA, string);
   return 1;
}
pawn Код:
CMD:ban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "* You need to be admin!");
    new id, reason[128], rcmsg[128], pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], string[128];
    if(sscanf(params, "is[128]", id,reason)) return SCM(playerid, COLOR_GREY, "USAGE: /ban [id] [reason]");
    if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_GREY, "This player is not connected.");
    if(id == playerid) return SCM(playerid, COLOR_GREY, "You cannot ban yourself.");
    SendClientMessage(id, COLOR_WHITE, "You have been banned from this server!");
    format(string, sizeof string, "Reason: %s", reason);
    SendClientMessage(id, COLOR_WHITE, string);
    GetPlayerName(playerid, aName, sizeof aName);
    format(string, sizeof string, "Admin: %s", aName);
    SCM(id, COLOR_WHITE, string);
    SCM(id, COLOR_WHITE, "If you think this is an unfair ban, create ban appeal at www.GranTrucking.com");
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof string, "Admin %s has banned %s. (Reason: %s)", aName, pName, reason);
    SCMAll(COLOR_WHITE, string);
    format(rcmsg, sizeof(rcmsg), "ban %s", id);
    SendRconCommand(rcmsg);
    Kick(id);
    return 1;
}
Could also try that.


Re: Ban command. - NathNathii - 23.02.2013

Quote:
Originally Posted by UnknownGamer
Посмотреть сообщение
pawn Код:
CMD:ban(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "* You need to be admin!");
    new id, reason[128], rcmsg[128], pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], string[128];
    if(sscanf(params, "is[128]", id,reason)) return SCM(playerid, COLOR_GREY, "USAGE: /ban [id] [reason]");
    if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_GREY, "This player is not connected.");
    if(id == playerid) return SCM(playerid, COLOR_GREY, "You cannot ban yourself.");
    SendClientMessage(id, COLOR_WHITE, "You have been banned from this server!");
    format(string, sizeof string, "Reason: %s", reason);
    SendClientMessage(id, COLOR_WHITE, string);
    GetPlayerName(playerid, aName, sizeof aName);
    format(string, sizeof string, "Admin: %s", aName);
    SCM(id, COLOR_WHITE, string);
    SCM(id, COLOR_WHITE, "If you think this is an unfair ban, create ban appeal at www.GranTrucking.com");
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof string, "Admin %s has banned %s. (Reason: %s)", aName, pName, reason);
    SCMAll(COLOR_WHITE, string);
    format(rcmsg, sizeof(rcmsg), "ban %s", id);
    SendRconCommand(rcmsg);
    Kick(id);
    return 1;
}
Could also try that.
I get error with that one but this one works now, but i want it to work for people with admin level 3 also.
Код:
CMD:ban(playerid, params[])
{
   if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF000000, "You must be an admin to use this command!");
   new pID, reason[128], playerName[MAX_PLAYER_NAME], adminName[MAX_PLAYER_NAME];
   if(sscanf(params, "rs[128]", pID, reason)) return SendClientMessage(playerid, 0xFF000000, "USAGE: /ban (nick/id) (reason)");
   if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF000000, "This player is not connected.");
   if(pID == playerid) return SendClientMessage(playerid, 0xFF000000, "You cannot ban yourself.");
   new string[128];
   SendClientMessage(pID, 0xFF000000, "You have been banned from this server!");
   format(string, sizeof string, "Reason: %s", reason);
   SendClientMessage(pID, 0xFF000000, string);
   GetPlayerName(playerid, adminName, sizeof adminName);
   format(string, sizeof string, "Admin: %s", adminName);
   SendClientMessage(pID, 0xFF000000, string);
   SendClientMessage(pID, 0xFF000000, "If you think this is an unfair ban, create ban appeal at www.GranTrucking.com");
   BanEx(pID, reason);
   GetPlayerName(playerid, playerName, sizeof playerName);
   format(string, sizeof string, "Admin %s has banned %s. (Reason: %s)", adminName, playerName, reason);
   SendClientMessageToAll(0xFF0000AA, string);
   return 1;
}



Re: Ban command. - UnknownGamer - 23.02.2013

Show me the errors.

Make sure your defining SCM.


Re: Ban command. - NathNathii - 23.02.2013

Oh works now, but only for rcon /:


Re: Ban command. - UnknownGamer - 23.02.2013

Quote:
Originally Posted by NathNathii
Посмотреть сообщение
Oh works now, but only for rcon /:
Thats because of,

if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "* You need to be admin!");

Remove that.


Re: Ban command. - SilverKiller - 23.02.2013

Quote:
Originally Posted by UnknownGamer
Посмотреть сообщение
Thats because of,

if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "* You need to be admin!");

Remove that.
That will make the command available for every person, but he wants the command for level 3 admins.

@thread poster: how do you check if a player is an admin level 3 in your script?