loop and Admins
#1

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);
            }
        }
    }
}
Reply
#2

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

nothing now i solved it

it dosent do anything IG,,,
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)