SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/02/2015, 06:50 AM   #1
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 808
Reputation: 103
Default Ban Bug [REP+]

Today I faced a bug with Ban System when I am trying to ban a player, the player is only geting kicked and then he is able to join again in server with the same name without chaning his IP

Can anyone tell me what is wrong and what can I do to fix it?
__________________
SecretBoss is offline   Reply With Quote
Old 15/02/2015, 06:52 AM   #2
Danish7
Little Clucker
 
Danish7's Avatar
 
Join Date: Oct 2013
Location: Inside Mount Chillad-Secret Base
Posts: 29
Reputation: 1
Default Re: Ban Bug [REP+]

Post the code
__________________

Danish7 is offline   Reply With Quote
Old 15/02/2015, 07:00 AM   #3
$$inSane
Gangsta
 
$$inSane's Avatar
 
Join Date: Feb 2012
Location: Behind you, you cant see me!!!
Posts: 658
Reputation: 56
Default Re: Ban Bug [REP+]

Make use of this:
pawn Code:
ban(playerid);
__________________
$$inSane is offline   Reply With Quote
Old 15/02/2015, 07:13 AM   #4
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 808
Reputation: 103
Default Re: Ban Bug [REP+]

the command is this

pawn Code:
CMD:ban(playerid, params[])
{
    LoginCheck(playerid);
    if(User[playerid][accountAdmin] >= 2)
    {
        new
            string[150],
            id,
            reason[128],
            when[128],
            ban_hr, ban_min, ban_sec, ban_month, ban_days, ban_years
        ;

        gettime(ban_hr, ban_min, ban_sec);
        getdate(ban_years, ban_month, ban_days);

        if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban [playerid] [reason]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, " "red"Player not connected.");
        if(User[playerid][accountAdmin] < User[id][accountAdmin])
        {
            SendClientMessage(playerid, -1, " "red"You cannot use this command on high ranking admin.");
            format(string, sizeof(string), "[NOTIFY] "white"%s has attempted to banned you with the reason %s.", GetName(playerid), reason);
            SendClientMessage(id, COLOR_ORANGE, string);

            format(string, sizeof(string), "%s has attempted to banned %s but failed for %s", GetName(playerid), GetName(id), reason);
            Log("admin.txt", string);
            return 1;
        }

        format(when, 128, "%02d/%02d/%d %02d:%02d:%02d", ban_month, ban_days, ban_years, ban_hr, ban_min, ban_sec);

        format(sInfo[last_bperson], 256, "%s", GetName(id));
        format(sInfo[last_bwho], 256, "%s", reason);
        savestatistics();

        AddBan(User[id][accountIP], 1);
        BanAcc(id, GetName(playerid), reason);
        ShowBan(id, GetName(playerid), reason, when);

        format(string, sizeof(string), "[BANNED] "white"%s has been banned by an admin for "grey"%s"white".", GetName(id), reason);
        SendPlayerMessage(COLOR_RED, string);
        format(string, sizeof(string), "[BANNED] "white"%s has been banned by %s for "grey"%s"white".", GetName(id), GetName(playerid), reason);
        SendAMessage(COLOR_RED, string);
        format(string, sizeof(string), "[BANNED] %s has been banned by %s for %s.", GetName(id), GetName(playerid), reason);
        Log("ban.txt", string);

        KickDelay(id);
    }
    else
    {
        SendClientMessage(playerid, -1, " "red"You are not authorized to use this command.");
    }
    return 1;
}
__________________
SecretBoss is offline   Reply With Quote
Old 15/02/2015, 08:07 AM   #5
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 808
Reputation: 103
Default Re: Ban Bug [REP+]

bump
__________________
SecretBoss is offline   Reply With Quote
Old 15/02/2015, 09:16 AM   #6
_Mohit_
Big Clucker
 
Join Date: Sep 2012
Location: India
Posts: 83
Reputation: 5
Default Re: Ban Bug [REP+]

Do you have a code under OnPlayerConnect to check weather the player is banned or not?
_Mohit_ is offline   Reply With Quote
Old 15/02/2015, 02:39 PM   #7
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 808
Reputation: 103
Default Re: Ban Bug [REP+]

Yes I have

pawn Code:
if(CheckBan(User[playerid][accountIP]) == 1)
    {
        SendClientMessage(playerid, -1, "If you think this is bugged try to relog, or contact a high ranking admin about this issue.");
        SendClientMessage(playerid, COLOR_RED, "[BANNED] "white"You are banned from this server, Server has matched your IP from one of our banned IP.");

        format(string, sizeof(string), "%s has connected to the server, Got banned having a matched ip from ban.cfg", GetName(playerid));
        Log("finn.txt", string);

        KickDelay(playerid);
        return 1;
    }
__________________
SecretBoss is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 06:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.