Posts: 484
Threads: 49
Joined: Feb 2011
I need command which will open ban files and take "BanName" from all of it and than go to the account of banned user and set Banned to 0....
This is just for one player, and you need to type his ip....
new banFILE[128],ip[32];
format(banFILE, 128, "NooBotRP/Users/Bans/%s.ban", ip);
new banneduser = dini_Get(banFILE,"BanName"));
format(file, sizeof(file),"NooBotRP/Users/%s.ini", banneduser);
dini_IntSet(file, "Banned", 0);
Ban files are named by ip_address.ban
Ban file contains:
BannedBy=DraGoN
BanDate=19/7/2011 at 16:57:46
BanReason=Cheat
BanName=Jeremy_Hakwins
Posts: 484
Threads: 49
Joined: Feb 2011
But how to make script to open all files from contain folder...
Posts: 484
Threads: 49
Joined: Feb 2011
That wouldn't work becuse ban files are ip.ban
for example 12.34.567.890.ban
Posts: 2,268
Threads: 89
Joined: Apr 2009
Reputation:
0
So what?
That doesn't matter at all.
It's still a string.
Posts: 484
Threads: 49
Joined: Feb 2011
This code works
pawn Код:
CMD:unbanipname(playerid, params[])
{
new banFILE[128],file[64],ip[64],string[128];
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
if(sscanf(params, "s[32]", ip)) return SendClientMessage(playerid, COLOR_WHITE, "Koriscenje: /unbanipname [playersIP]");
format(banFILE, 128, "NooBotRP/Users/Bans/%s.ban", ip);
new banneduser[MAX_STRING];
banneduser = dini_Get(banFILE,"BanName");
format(string, sizeof(string), "* Played unbanned %s.", banneduser);
SendClientMessage(playerid, COLOR_GREY, string)
format(file, sizeof(file),"NooBotRP/Users/%s.ini", banneduser);
dini_IntSet(file, "BanovanAcc", 0);
return 1;
}
Trying to loop but dont work...
pawn Код:
CMD:unbanall(playerid, params[])
{
new banFILE[128],file[64];
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
if (isnull(params))
{
for(new i = 0; i != 200; ++i)
{
format(banFILE, 128, "NooBotRP/Users/Bans/%s.ban", i);
new banneduser[MAX_STRING];
banneduser = dini_Get(banFILE,"BanName");
format(file, sizeof(file),"NooBotRP/Users/%s.ini", banneduser);
dini_IntSet(file, "BanovanAcc", 0);
}
}
return 1;
}
Anyone? How to loop?