Is it right?
#1

Hey, some people will say test it and come
I just don't have anyone to test it with right now, and I have to get off the PC and get on it next week end,
so just, here we go

pawn Код:
dcmd_ban(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new Spname[MAX_PLAYER_NAME];
    new string[128];
    new cmdreason[100];
    new id;
    if(sscanf(params,"us[100]",id,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /ban (Player Name/ID) (Reason)");
        return 1;
    }
    if(!IsPlayerConnected(id))
    {
        SendClientMessage(playerid, COLOR_RED, "The player is not connected to the server");
        return 1;
    }
    GetPlayerName(id, pname, sizeof(pname));
    format(string,sizeof(string),"***An Administrator has banned %s(%d) from the server.  (Reason: %s)",pname,id,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);
    PlayerInfo[id][pBanned] =1;
    GameTextForPlayer(id, "~r~BANNED",1000000,4);
    Kick(id);

    GetPlayerName(id, pname, sizeof(pname));
    format(string,sizeof(string),"***An Administrator has banned %s(%d) from the server.  (Reason: %s)",pname,id,cmdreason);
    IRC_GroupSay(groupID,IRC_CHANNEL,string);
    IRC_GroupSay(groupID,ADMIN_CHANNEL,string);

    GetPlayerName(id,pname,MAX_PLAYER_NAME);
    GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has banned %s(%d). (Reason: %s)",Spname,playerid,pname,id,cmdreason);
    SendAdminMessage(COLOR_PINK, string);
    return 1;
}
//============================================================================//
dcmd_unban(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new Spname[MAX_PLAYER_NAME];
    new path[128];
    new string[128];
    if(sscanf(params,"u",pname))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /unban (Player Name/ID) (Reason)");
        return 1;
    }
    GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",Spname, playerid, pname);
    IRC_GroupSay(groupID,ADMIN_CHANNEL,string);

    GetPlayerName(playerid,Spname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",Spname,playerid,pname);
    SendAdminMessage(COLOR_PINK, string);

    if(!fexist(path)) return SendClientMessage(playerid,COLOR_RED,"ERROR: Player Unknown to the Database.");

    new INI:File = INI_Open(UserPath(playerid));
    INI_WriteInt(File,"Banned",0);
    INI_Close(File);
    return 1;
}
//============================================================================//
//Command BAN.
IRCCMD:iunban(botid, channel[], user[], host[], params[])
{
    // Check if the user is at least an op in the channel
    if (IRC_IsOp(botid, channel, user))
    {
        new playerid, reason[64];
        // Check if the user at least entered a player ID
        if (sscanf(params, "dS(No reason)[64]", playerid, reason))
        {
            return 1;
        }
            // Echo the formatted message
            new name[MAX_PLAYER_NAME];
            new path[128];
            new string[128];
           
            format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
            IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
           
            format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
            SendAdminMessage(COLOR_PINK, string);
           
            if(!fexist(path))
            {
               format(string,sizeof(string),"ERROR: Player not known to database.");
               IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
            }
            new INI:File = INI_Open(UserPath(playerid));
            INI_WriteInt(File,"Banned",0);
            INI_Close(File);
    }
    return 1;
}
//============================================================================//
//Command UNBAN.
IRCCMD:iunban(botid, channel[], user[], host[], params[])
{
    // Check if the user is at least an op in the channel
    if (IRC_IsOp(botid, channel, user))
    {
        new playerid, reason[64];
        new id;
        // Check if the user at least entered a player ID
        if (sscanf(params, "dS(No reason)[64]", playerid, reason))
        {
            return 1;
        }
        // Check if the player is connected
        if (IsPlayerConnected(id))
        {
            // Echo the formatted message
            new name[MAX_PLAYER_NAME];
            new path[128];
            new string[128];
           
            format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
            IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
           
            format(string,sizeof(string),"[ADMIN UPDATE] Administrator %s(%d) has un-banned %s.",user, name);
            SendAdminMessage(COLOR_PINK, string);
           
            if(!fexist(path))
            {
               format(string,sizeof(string),"ERROR: Player not known to database.");
               IRC_GroupSay(groupID,ADMIN_CHANNEL,string);
            }
            new INI:File = INI_Open(UserPath(playerid));
            INI_WriteInt(File,"Banned",0);
            INI_Close(File);
        }
    }
    return 1;
}
http://pastebin.com/fkKRJXep
I'd appreciate help.
Reply
#2

Bump :/ I know I must wait 48 hours, but I need it asap, sorry.
Reply
#3

Why are you removing params:
pawn Код:
#pragma unused params
??
Remove this line.
Reply
#4

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Why are you removing params:
pawn Код:
#pragma unused params
??
Remove this line.
Because dcmd gives symbol unused warning on compile and he did that to prevent the warning :/
Reply
#5

Quote:
Originally Posted by Glint
Посмотреть сообщение
Because dcmd gives symbol unused warning on compile and he did that to prevent the warning :/
Yes, anyways, /unban and !iunban aren't working fine..
someone? :/
Reply
#6

Would you show me your code below OnPlayerConnect callback? specifically the one that kicks/bans a player if he was found banned in his userfile.
Reply
#7

Quote:
Originally Posted by Glint
Посмотреть сообщение
Because dcmd gives symbol unused warning on compile and he did that to prevent the warning :/
No it wouldn't. He is obviously using "params" under sscanf so that warning would go away. It only shows, when your not using that section of the syntax.


Quote:
Originally Posted by Randy More
Посмотреть сообщение
Would you show me your code below OnPlayerConnect callback? specifically the one that kicks/bans a player if he was found banned in his userfile.
^

Your unban command doesn't make any sense. You have a [pBanned] variable so I am guessing your checking when they connect if they are banned or not, and if they are, they are kicked or something. If that's the case your unban command will not work at all. The only way for them to be unbanned by using your command, is if they are connected and not kicked off the server and then their variable could be cleared(0, -1, whatever you use) for a proper unban.

You could do something like, if they are banned they can still connect to the server but are muted, frozen, can't see, etc and have to request an unban. And maybe kick them every 10 or so minutes so they don't block up player slots. Just my little 2 cent suggestion
Reply
#8

Steven, I know,
I changed the unban to new INIOPEN.......................

but still didn't work out..
pawn Код:
//Public OnPlayerConnect.
public OnPlayerConnect(playerid)
{
         if(PlayerInfo[playerid][pBanned] == 1)
         {
           new string[254];
           format(string, sizeof(string), "*** You have been banned from the server, visit http://www.sa-cnc.co.cc to make a ban appeal.");
           SendClientMessage(playerid,COLOR_RED, string);
           Kick(playerid);
           return 1;
         }
Reply
#9

You have to load the player's file, so it knows he's banned.
Reply
#10

Someone post /unban and irccmd:iunban please, I've done my best still didn't work it out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)