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