23.12.2013, 08:38
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..
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.
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;
}
Is my setup correct?
Please do explain and help me out .. Thank you.