Ban an IP
#1

Hello,

I have a question,

How can I make something that Bans the IP also the name? (Ban(playerid) Just bans the player, I want it to ban an IP -- Thinking about using it like this


/ban


PlayerInfo[playerid][Banned] = 1;
BanIP(playerid); etc
Reply
#2

BanEx(playerid, reason);
Ban(playerid);

These are stored into samp.ban, BanEx has a reason and regular Ban has no reason

They both ban IPs

EDIT: Re-read the original post...To ban the name you could do something like....


I'll use dini as an example
pawn Код:
OnPlayerConnect(playerid)
{
    new file[50];
    format(file, sizeof(file), "Accounts/%s", Name(playerid));
    if(dini_Exists(file))
    {
        if(dini_Int(file, "Banned") == 1)
        {
            new reason[75];
            format(reason,sizeof(reason), "%s[%d] has been kicked -Name Banned.", Name(playerid), playerid);
            SendClientMessageToAll(0xCC0000AA, reason);
            Kick(playerid);
        }
    }
}
In the ban command;
pawn Код:
new file[50];
format(file, sizeof(file), "Accounts/%s", Name(playerid));
if(dini_Exists(file)) dini_SetInt(file, "Banned", 1);

You'd need this to copy/paste that in...Which I don't recommend, should modify it to your needs
pawn Код:
stock Name(playerid)
{
    new nname[MAX_PLAYER_NAME]; //Creates the variable we will store the players name in
    GetPlayerName(playerid, nname, sizeof(nname)); //Gets the name storing it into our nname variable & the length will be max_player_name
    return nname; //Returns the name of the player
}
Reply
#3

Oh, alright thank you ^^.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)