SA-MP Forums Archive
/ban Command problem - 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 problem (/showthread.php?tid=560016)



/ban Command problem - Youssef221 - 26.01.2015

So, when i use /ban on someone, then after a while when someone joins a server, he gets automatically kicked, saying: You are banned from this server, they both (the one who is banned and the one who has got unfairly kicked) have different ips, i don't know what to do so..

pawn Код:
COMMAND:ban(playerid, params[])
{
    new id, reason[60], Message8[128], PNAME8[MAX_PLAYER_NAME],PNAME9[MAX_PLAYER_NAME];

    if (PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, 0xFF0000AA, "You Are Not An Administrator!");
    if (sscanf(params, "us[60]", id, reason)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /ban <playerid/partname> <reason>");
    if (strlen(reason) < 0 || strlen(reason) == 0) return SendClientMessage(playerid, 0xFF0000AA,"No Reason Given!");
    if (strlen(reason) <= 5 || strlen(reason) >= 25) return SendClientMessage(playerid, 0xFF0000AA,"Invalid Reason!");
    if (id == INVALID_PLAYER_ID || !IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "Player Not Connected");
    if(PlayerInfo[playerid][pAdmin] <= PlayerInfo[id][pAdmin]) return SendClientMessage(playerid, COLOR_RED,"You cannot use this command on higher level or in an admin with your lvl!");
    GetPlayerName(playerid, PNAME9, MAX_PLAYER_NAME);
    GetPlayerName(id, PNAME8, MAX_PLAYER_NAME);
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
          switch(PlayerInfo[playerid][pAdmin])
          {
          case 1: AdmRank = "Trial Moderator";
          case 2: AdmRank = "Moderator";
          case 3: AdmRank = "Master Moderator";
          case 4: AdmRank = "Trial Administrator";
          case 5: AdmRank = "Administrator";
          case 6: AdmRank = "Master Administrator";
          case 7: AdmRank = "Head Administrator";
          case 8: AdmRank = "Trusted Administrator";
          case 9: AdmRank = "Co-Owner";
          case 10: AdmRank = "Owner";
          }
          format(Message8, sizeof (Message8), "You Have Been Banned By The %s %s (%d).",AdmRank ,PNAME9 ,playerid);
          SendClientMessage(id, 0xFFC400AA, "If You Feel That You Are Wrongly Banned Feel Free To Post An Appeal In Forum: lsgangwars.createaforum.com");
          format(Message8, sizeof (Message8), "The {FF0000}%s {FFAE00}%s (%d) Has Banned %s (%d) | Reason: %s.",AdmRank ,PNAME9 ,playerid, PNAME8, id, reason);
          SendClientMessageToAll(0xFFAE00AA, Message8);
          SetPVarString(id, "BanReason",reason);
          SetTimerEx("BanExDelay", false, 1000, "i",id);
          Info[id][Banned] = 1;
    }
    foreach(Player, i)
    {
         if(PlayerInfo[i][pAdmin] > 0)
         {
            format(Message8, sizeof(Message8), "[ADM] The {FF0000}%s {FF5900}%s (%d) Has Banned %s (%d) | Reason: %s.",AdmRank, PNAME9, playerid, PNAME8, id, reason), SendClientMessage(i, 0xFF5900FF, Message8);
            print(Message8);
         }
    }
    return 1;
}
forward BanExDelay(playerid);
public BanExDelay(playerid)
{
    new reason[60];
    GetPVarString(playerid, "BanReason",reason, sizeof(reason));
    BanEx(playerid, reason);
    return 1;
}
plz help me.


Re: /ban Command problem - ATGOggy - 26.01.2015

Can you elaborate?


Re: /ban Command problem - Youssef221 - 26.01.2015

What do you mean?


Re: /ban Command problem - ATGOggy - 26.01.2015

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
What do you mean?
Can you explain more about what's the problem?


Re: /ban Command problem - Youssef221 - 26.01.2015

I mean, when i ban someone, after that when someone else joins, He gets automatically kicked, it says to him: You are banned from this server. and it writes in samp.bans that he is banned, Reason Null


Re: /ban Command problem - denNorske - 26.01.2015

Would you mind showing us the part of "OnPlayerConnect" that kicks the player / adds the ban?

Thanks.


Re: /ban Command problem - Youssef221 - 26.01.2015

There's nothing that kicks the player onplayerconnect (except the original banned player), it just kicks the innocent player like he is banned before


Re: /ban Command problem - ATGOggy - 26.01.2015

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
There's nothing that kicks the player onplayerconnect (except the original banned player), it just kicks the innocent player like he is banned before
Does he connect to the server?


Re: /ban Command problem - Youssef221 - 26.01.2015

He tries to connect but it says: You are banned from this server, and then he gets banned for no reason.