/unbanall -
Dragony92 - 25.08.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
Re: /unbanall -
=WoR=G4M3Ov3r - 25.08.2011
Wrong Section.
Re: /unbanall -
[MWR]Blood - 25.08.2011
Try doing a loop.
Re: /unbanall -
Dragony92 - 25.08.2011
But how to make script to open all files from contain folder...
Re: /unbanall -
[MWR]Blood - 25.08.2011
pawn Код:
for(new i = 0; i != 200; ++i)
{
format(str,sizeof(str),"BAN_DIRECTORY_GOES_HERE/%s.ini",i);
//other code goes here...
}
Try sumthing like that..
Re: /unbanall -
Dragony92 - 25.08.2011
That wouldn't work becuse ban files are ip.ban
for example 12.34.567.890.ban
Re: /unbanall -
[MWR]Blood - 25.08.2011
So what?
That doesn't matter at all.
It's still a string.
Re: /unbanall -
Dragony92 - 25.08.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?
Re: /unbanall -
iggy1 - 25.08.2011
Quote:
Originally Posted by Delux13
So what?
That doesn't matter at all.
It's still a string.
|
Ofc it matters. You can't use a string like an int inside the loop expression. That would look like this.
pawn Код:
for(new "lol"; "lol" < "rofl"; "lol"++)