Ban command.
#1

// FIXED!
Reply
#2

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.
Reply
#3

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!");
Reply
#4

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

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.
Reply
#6

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;
}
Reply
#7

Show me the errors.

Make sure your defining SCM.
Reply
#8

Oh works now, but only for rcon /:
Reply
#9

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.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)