Unban Command - 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: Unban Command (
/showthread.php?tid=446894)
Unban Command -
jackci - 27.06.2013
Hi,
I have a command which bans a player ingame
pawn Код:
Kick(player2);
SetPVarInt(playerid2, "Banned", 1);
How do I create a command that unbans an offline player using /unban [name] ?
I would appreciate the help as i am a newbie
Re: Unban Command -
Kittylol - 27.06.2013
I suggest you download ban/kick system,which is simple to use.I suggest you to don't mess with this,and do something faster and without problems.I suggest you download simple admin system:
https://sampforum.blast.hk/showthread.php?tid=372508
Re: Unban Command -
park4bmx - 27.06.2013
well you need to save the banned players in a list somewhere with their name
and when
UnBanning loop to see what name matches and just unbann the ip next to it
Re: Unban Command -
jackci - 27.06.2013
Can I get an example ? I'm new to scripting sorry
Re: Unban Command -
park4bmx - 27.06.2013
Using
Y_INI as the saving system
And
ZCMD as the command processor
pawn Код:
COMMAND:ban(playerid, params[])
{
new targetid,String[60];
if(sscanf(params,"us[60]", targetid,String)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /Ban [playerid] [REASON]");
new OtherN[MAX_PLAYER_NAME];
GetPlayerName(targetid, OtherN, sizeof(OtherN));
//Save it
new file[128];
format(file,sizeof(file),"/Bans/%s.txt",OtherN);//you need a Ban folder
{
new INI:Acc = INI_Open(file);
new IP[16];
GetPlayerIp(targetid, IP, sizeof IP);
INI_WriteString(Acc,"IP", IP);
INI_Close(Acc);
}
}
new PlayerIP;
COMMAND:unban(playerid, params[])
{
new TName[MAX_PLAYER_NAME];
if(sscanf(params,"s[MAX_PLAYER_NAME]", TName) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /UnBan [player Name]");
new file[128],IPCMD[26];format(file,sizeof(file),"/Bans/%s.txt",TName);
if(fexist(file))//player found
{
INI_ParseFile(file, "LoadIP", false, false);
format(IPCMD,sizeof IPCMD,"unbanip %s",PlayerIP);
SendRconCommand(IPCMD);
}
}
forward LoadIP(name[], value[]);
public LoadIP(name[], value[])
{
if(!strcmp(name, "IP", true)) { PlayerIP = strval(value); }
}
Something like that, there might a few mistakes here & there
Re: Unban Command -
jackci - 27.06.2013
Thank you
I will test this later
Re: Unban Command -
jackci - 28.06.2013
pawn Код:
format(IPCMD,sizeof IPCMD,"unbanip %s",PlayerIP);
SendRconCommand(IPCMD);
Shouldnt I reloadbans after this ?
Re: Unban Command -
jackci - 29.06.2013
Help