SA-MP Forums Archive
loop and Admins - 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)
+--- Thread: loop and Admins (/showthread.php?tid=298794)



loop and Admins - Speed - 22.11.2011

This is a part of code...

I want if player have a minigun,.... that he get ban if isnt admin online, if admin is online that message is send to admin as warning

pawn Код:
new string[128];
    if(GetPlayerWeapon(playerid) == 36 && PlayerInfo[playerid][pAdmin] < 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
            {
                format(string, sizeof(string), "Player %s check him!", PlayerName(playerid));
                SendAdminMessage(1,COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, Grey, "Ban");
                BanPlayer(playerid);
            }
        }
    }
    if(GetPlayerWeapon(playerid) == 35 && PlayerInfo[playerid][pAdmin] < 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
            {
                format(string, sizeof(string), "Player %s check him!", PlayerName(playerid));
                SendAdminMessage(1,COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, Grey, "Ban!");
                BanPlayer(playerid);
            }
        }
    }
    if(GetPlayerWeapon(playerid) == 38 && PlayerInfo[playerid][pAdmin] < 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pAdmin] > 0 || IsPlayerConnected(i))
            {
                format(string, sizeof(string), "Player %s chech him!", PlayerName(playerid));
                SendAdminMessage(1,COLOR_RED, string);
            }
            else
            {
                SendClientMessage(playerid, Grey, "Ban!");
                BanPlayer(playerid);
            }
        }
    }
here is SendAdminMessage...

pawn Код:
forward SendAdminMessage(lvl, color, string[]);
public SendAdminMessage(lvl, color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin] >= lvl)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
}



Re: loop and Admins - Kingunit - 22.11.2011

What is wrong with the current code? It bugs? Gives errors?


Re: loop and Admins - Speed - 22.11.2011

nothing now i solved it

it dosent do anything IG,,,


Re: loop and Admins - Sinc - 22.11.2011

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
What is wrong with the current code? It bugs? Gives errors?
The looping instruction proceeds the function which handles the check.