SA-MP Forums Archive
Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help. (/showthread.php?tid=202340)



Help. - Freddi-25 - 23.12.2010

I'm unsure about this one.

I'm going to make an admin system, but how can I make the admin kick all normal players, meaning the admins won't be kicked.

Help?


Respuesta: Help. - admantis - 23.12.2010

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if (!IsPlayerAdmin(i)) // Change this to your admin variable, but remember to put 'i', not 'playerid'!
    {
        Kick(i);
    }
}



Re: Help. - Freddi-25 - 23.12.2010

pawn Код:
cmd(kickall, playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not the admin level required to do this command!");
    else
    {
        if (PlayerInfo[playerid][pAdminLevel] = 5);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdminLevel] < 1);
            {
                Kick(i);
            }
        }
    }
    return 1;
}
How can I make this work? :/


Re: Help. - WillyP - 23.12.2010

pawn Код:
cmd(kickall, playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not the admin level required to do this command!");
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdminLevel] < 1);
            {
                Kick(i);
            }
        }
    }
    return 1;
}



Re: Help. - Raz0r1000 - 23.12.2010

Try reading some tutorials on scripting before making an entire Admin Script


Re: Help. - Freddi-25 - 23.12.2010

pawn Код:
cmd(kickall, playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not the admin level required to do this command!");
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdminLevel] < 1); // this line
            {
                Kick(i);
            }
        }
    }
    return 1;
}

(1770) : error 036: empty statement


And btw, I do know some scripting, but I'm confused on this one..


Re: Help. - Hiitch - 23.12.2010

Remove the semicolon from that if statement. (Line 1770 - the error line)


Re: Help. - WillyP - 23.12.2010

Quote:
Originally Posted by Hiitch
Посмотреть сообщение
Remove the semicolon from that if statement. (Line 1770 - the error line)
No, because it will kick all the Admins too.


Re: Help. - admantis - 24.12.2010

pawn Код:
cmd(kickall, playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not the admin level required to do this command!");
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdminLevel] == 0)
            {
                Kick(i);
            }
        }
    }
    return 1;
}