Ban an IP - 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 an IP (
/showthread.php?tid=308357)
Ban an IP -
Thunderbolt - 03.01.2012
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
Re: Ban an IP -
[ABK]Antonio - 03.01.2012
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
}
Re: Ban an IP -
Thunderbolt - 03.01.2012
Oh, alright thank you ^^.