SA-MP Forums Archive
Annoying problem - 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: Annoying problem (/showthread.php?tid=244866)



Annoying problem - blackwave - 28.03.2011

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"


Re: Annoying problem - MrDeath537 - 28.03.2011

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.


Re: Annoying problem - blackwave - 28.03.2011

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


Re: Annoying problem - blackwave - 29.03.2011

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


Re: Annoying problem - Gamer_Z - 29.03.2011

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


Re: Annoying problem - blackwave - 29.03.2011

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.