1 Error with my anticheat.
#1

Код:
C:\DOCUME~1\User\Desktop\MYNEWE~1\GAMEMO~1\SU.pwn(28657) : error 029: invalid expression, assumed zero
C:\DOCUME~1\User\Desktop\MYNEWE~1\GAMEMO~1\SU.pwn(28657) : warning 215: expression has no effect
C:\DOCUME~1\User\Desktop\MYNEWE~1\GAMEMO~1\SU.pwn(28657) : error 001: expected token: ";", but found "if"
pawn Код:
forward AntiCheat();
public AntiCheat()
{
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && ADMIN[i] == 0)
        {
            GetPlayerWeaponData(i, 7, weap, ammo); //Missle Launcher
            else if(ammo > 1 && weap == 36 && MISSLE36[i] == false) //Line With Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Missle Launcher]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Missle Launcher]");
            }
        }
    }
    return 1;
}
Reply
#2

pawn Код:
forward AntiCheat();
public AntiCheat()
{
    new weap[13][2];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && ADMIN[i] == 0)
        {
             GetPlayerWeaponData(playerid, i, weap[i][0], weap[i][1]); //Missle Launcher
            else if(ammo > 1 && weap == 36 && MISSLE36[i] == false) //Line With Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Missle Launcher]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Missle Launcher]");
            }
        }
    }
    return 1;
}
Reply
#3

You used 'else if' instead of 'if'

pawn Код:
forward AntiCheat();
public AntiCheat()
{
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && ADMIN[i] == 0)
        {
            GetPlayerWeaponData(i, 7, weap, ammo); //Missle Launcher
            if(ammo > 1 && weap == 36 && MISSLE36[i] == false) //Line With Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Missle Launcher]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Missle Launcher]");
            }
        }
    }
    return 1;
}
Reply
#4

no I just snipped that out of the code. The first few doesn't have the error. This is my whole code:


pawn Код:
forward AntiCheat();
public AntiCheat()
{
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && ADMIN[i] == 0)
        {
            GetPlayerWeaponData(i, 7, weap, ammo); //This is the only one taht does not give a error
            if(ammo > 1 && weap == 35)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Heat Seaking Missle]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Heat Seaking Missle]");
            }
            GetPlayerWeaponData(i, 7, weap, ammo); //Need to define this for each cause the weapon slot changes.
            else if(ammo > 1 && weap == 36 && MISSLE36[i] == false) //Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Missle Launcher]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Missle Launcher]");
            }
            GetPlayerWeaponData(i, 7, weap, ammo); //Flame Thrower
            else if(FLAME37[i] == false && ammo > 1 && weap == 37) //Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Flame Thrower]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Flame Thrower]");
            }
            GetPlayerWeaponData(i, 7, weap, ammo); //Minigun
            else if(MINI38[i] == false && ammo > 1 && weap == 38) //Error
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Minigun]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Minigun]");
            }
            GetPlayerWeaponData(i, 11, weap, ammo); //Error
            else if(ammo > 1 && weap == 44) //Night Vision
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Night Vision]", pName);
                SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Night Vision]");
            }
            GetPlayerWeaponData(i, 11, weap, ammo); //Error
            else if(ammo > 1 && weap == 45) //Thermal Goggles
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console. [Thermal Vision]", pName);
        SendClientMessageToAll(COLOR_RED, string);
                printf(string);
                GetPlayerName(i, pName, sizeof(pName));
                BanEx(i, "%s has been auto banned by console. [Thermal Vision]");
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)