Hello, Need abit of a help with.. -
Gill - 23.12.2013
Hello,
I need litle help with unbanning player, actualy, I wanna set every single user account's Permbanned to 0, and I'm struggling with the command.. Here is what i made little..
pawn Код:
CMD:unbanallplayers(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 8)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
foreach(Player,i)
OnPlayerOfflineLogin(i);
if( PlayerInfo[i][pPermaBanned] >= 1)
{
PlayerInfo[i][pPermaBanned] = 0;
PlayerInfo[i][pBanned] = 0;
PlayerInfo[i][pWarns] = 0;
PlayerInfo[i][pDisabled] = 0;
RemoveBan(PlayerInfo[i][pIP]);
print("DEBUG: Saving variables to file");
OnPlayerOfflineSave(i);
print("DEBUG: Variables saved properly");
}
else { //Still sets it to 0 even if not banned.
PlayerInfo[i][pPermaBanned] = 0;
PlayerInfo[i][pBanned] = 0;
print("DEBUG: (ELSE MODE) Players has successfully been unbanned");
OnPlayerOfflineSave(i);
print("DEBUG: (ELSE MODE) All player accounts has been saved.");
}
return 1;
}
foreach is for al players right, I'm abit confused .. if i can use it for ofline loop aswell..
Is my setup correct?
Please do explain and help me out .. Thank you.
Re: Hello, Need abit of a help with.. -
park4bmx - 23.12.2013
You can't use it for offline players this way as you don't know their
ID that they will connect or even the name.
there are several options.
1.make a file containing every single name that has played your server and use it for looping those players so then you will know they will have a save file on your server with the ban status.
2. There was a file/directory plugin which listed the files in a directory.
Other then that don't think there's another way to know the offline players
Re: Hello, Need abit of a help with.. -
Gill - 23.12.2013
Quote:
Originally Posted by park4bmx
You can't use it for offline players this way as you don't know their ID that they will connect or even the name.
there are several options.
1.make a file containing every single name that has played your server and use it for looping those players so then you will know they will have a save file on your server with the ban status.
2. There was a file/directory plugin which listed the files in a directory.
Other then that don't think there's another way to know the offline players
|
No there must be some other way, like get all the user.ini files.., read from it one by one and set Ban to 0.. anyone else knows
Re: Hello, Need abit of a help with.. -
dominik523 - 23.12.2013
Foreach only works for online players. You would need some other way to go through all player files.
Re: Hello, Need abit of a help with.. -
Gill - 23.12.2013
Quote:
Originally Posted by dominik523
Foreach only works for online players. You would need some other way to go through all player files.
|
Any other way anyone can help me out?
Re: Hello, Need abit of a help with.. -
Threshold - 23.12.2013
There is a way, but it's an absolute datafuck. You would have to loop through each individual character from A-Z, 0-9 and including symbols, 24 times over for each character to see if the file exists. If it exists, change the variable to 0. So in short terms, don't do it. Either that, or you create a ban log, get the server to loop through the text file contents, and search for the contents line by line with the usernames. Then edit that user file. Again, it's a big time waster though..