Annoying problem
#1

I'm putting a weapon anti-cheat on my script, and it keep giving me a automatic ban when I spawn. But I've seen on other tutorials the same thing as am doing on my script. Looks like:
pawn Код:
new Fweapons[][] =
{
    17, 35, 36, 37, 38, 39, 40, 44, 45
};
public OnPlayerUpdate(playerid)
{
    static string[200];
    for(new fw; fw < sizeof(Fweapons); fw++)
    {
        if(GetPlayerWeapon(playerid) == fw && GetPlayerState(playerid) != PLAYER_STATE_WASTED)
        {
            format(string,sizeof(string),""#red"%s "#green"(id: %d) "#ice" has been banned by the administrator BOT |"#yellow" Reason: Weapon hacks",GetMyName(playerid),playerid);
            GetPlayer(playerid);
            ini = INI_Open(playerfile);
            INI_WriteString(ini, "Banned", "Yes");
            INI_WriteString(ini, "Reason", "Weapon hacks");
            INI_Close(ini);
            MsgForAll(color,string);
            SoundForAll(1148);
            Kick(playerid);
        }
       
    }
    return 1;
}
After registering / spawing, it kicks me. The good looks correct as other tutorials and by what I know about "sizeof"
Reply
#2

You're doing bad the loop, fixed version:

pawn Код:
new Fweapons[] =
{
    17, 35, 36, 37, 38, 39, 40, 44, 45
};
public OnPlayerUpdate(playerid)
{
    static string[200];
    for(new fw; fw < sizeof(Fweapons); fw++)
    {
        if(GetPlayerWeapon(playerid) == Fweapons[fw] && GetPlayerState(playerid) != PLAYER_STATE_WASTED)
        {
            format(string,sizeof(string),""#red"%s "#green"(id: %d) "#ice" has been banned by the administrator BOT |"#yellow" Reason: Weapon hacks",GetMyName(playerid),playerid);
            GetPlayer(playerid);
            ini = INI_Open(playerfile);
            INI_WriteString(ini, "Banned", "Yes");
            INI_WriteString(ini, "Reason", "Weapon hacks");
            INI_Close(ini);
            MsgForAll(color,string);
            SoundForAll(1148);
            Kick(playerid);
        }
    }
    return 1;
}
Good luck.
Reply
#3

lol dude, it doesn't works. It's really annoying: keep getting banned by nothing, and I'm not using one of weapons from the variable
Reply
#4

Also I had this system another time, but this time doesn't works, and ever bans me
Reply
#5

you need to check if the player is spawned or not etc...
Reply
#6

I think it's not that, because it just bans me when I spawn, and also I'm not using any of those weapons on the array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)