Anti Fly Hack Bug
#1

So here is the code,the problem is that sometimes It bans players for sitting or laying (while using a anim) on a driving vehicle. Is there any way I can sort this out?
PHP код:
public OnPlayerUpdate(playerid)
{
    
//Fly Hack
    
new Float:Pos_x,Float:Pos_y,Float:Pos_z// We create the variable that will save the velocity of the player
    
new anim GetPlayerAnimationIndex(playerid); // We create the variable that will save the anim that player is using
    
GetPlayerVelocity(playerid,Pos_x,Pos_y,Pos_z); // We get the player velocity and we set it to the variable
    
if(Pos_x <= -0.800000  || Pos_y <= -0.800000 || Pos_z <= -0.800000 && anim == 1008// If  x,y,z is -0.800000 or bigger and the player is using parachute animation
{
    
BanEx(playerid"Fly Hack"); // Ban the player with reason Fly Hack
    
return 1// Return 1 :)

Reply
#2

Don't ever use these kinds of stuff in OnPlayerUpdate, use a timer for that.

PHP код:
// Variables
new acT;
// OnGameModeInit
acT SetTimer("AntiFly"1500true);
// OnGameModeExit
KillTimer(acT);
// function
forward public AntiFly();
public 
AntiFly()
{
    for(new 
iGetPlayerPoolSize(); <= li++)
    {
        if(
IsPlayerConnected(i))
        {
            
//Fly Hack 
            
new Float:Pos_xFloat:Pos_yFloat:Pos_zanim GetPlayerAnimationIndex(i);
            
GetPlayerVelocity(iPos_xPos_yPos_z);
            if(
anim == 1008 && GetPlayerWeapon(i) != 46 && (Pos_x <= -0.900000  || Pos_y <= -0.900000 || Pos_z <= -0.900000))
            {
                
BanEx(i"Fly Hack"); // Ban the player with reason Fly Hack
                
return 1;
            }
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Don't ever use these kinds of stuff in OnPlayerUpdate, use a timer for that.

PHP код:
// Variables
new acT;
// OnGameModeInit
acT SetTimer("AntiFly"1500true);
// OnGameModeExit
KillTimer(acT);
// function
forward public AntiFly();
public 
AntiFly()
{
    for(new 
iGetPlayerPoolSize(); <= li++)
    {
        if(
IsPlayerConnected(i))
        {
            
//Fly Hack 
            
new Float:Pos_xFloat:Pos_yFloat:Pos_zanim GetPlayerAnimationIndex(i);
            
GetPlayerVelocity(iPos_xPos_yPos_z);
            if(
anim == 1008 && GetPlayerWeapon(i) != 46 && (Pos_x <= -0.900000  || Pos_y <= -0.900000 || Pos_z <= -0.900000))
            {
                
BanEx(i"Fly Hack"); // Ban the player with reason Fly Hack
                
return 1;
            }
        }
    }
    return 
1;

Hey man I tested the code out and you can now usefly hack? Any suggestions?
Tnx in advance
Reply
#4

I think it might be more effective.
PHP код:
forward AntiFly();
public 
AntiFly(){
    if(!
IsPlayerInAnyVehicle(i)){
        switch(
GetPlayerAnimationIndex(i)){
            case 
958959: {
                new 
wepidammo;
                
GetPlayerWeaponData(i,11,wepid,ammo);
                if(
wepid != 46){
                    if(
IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
                        
//you code
                        
Kick(i);
                        return 
1;
                    }
                }
            }
            case 
15391058: {
                if(
IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
                    
//you code
                    
Kick(i);
                    return 
1;
                }
            }
        }
    }
    return 
1;

ColAndreas Plugin:
https://sampforum.blast.hk/showthread.php?tid=586068

3DTryg:
https://sampforum.blast.hk/showthread.php?tid=591010
Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
I think it might be more effective.
PHP код:
forward AntiFly();
public 
AntiFly(){
    if(!
IsPlayerInAnyVehicle(i)){
        switch(
GetPlayerAnimationIndex(i)){
            case 
958959: {
                new 
wepidammo;
                
GetPlayerWeaponData(i,11,wepid,ammo);
                if(
wepid != 46){
                    if(
IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
                        
//you code
                        
Kick(i);
                        return 
1;
                    }
                }
            }
            case 
15391058: {
                if(
IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
                    
//you code
                    
Kick(i);
                    return 
1;
                }
            }
        }
    }
    return 
1;

ColAndreas Plugin:
https://sampforum.blast.hk/showthread.php?tid=586068

3DTryg:
https://sampforum.blast.hk/showthread.php?tid=591010
Код:
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(100) : error 017: undefined symbol "i"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(101) : error 017: undefined symbol "i"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(104) : error 017: undefined symbol "i"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(106) : error 017: undefined symbol "IsCollisionFlag"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(108) : error 017: undefined symbol "i"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(114) : error 017: undefined symbol "IsCollisionFlag"
C:\Users\tin_l\Desktop\NG\gamemodes\NG.pwn(116) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
Reply
#6

Quote:
Originally Posted by xxxSpeedxxx
Посмотреть сообщение
PHP код:
if(Pos_x <= -0.800000  || Pos_y <= -0.800000 || Pos_z <= -0.800000 && anim == 1008
This line is the culprit. AND has a higher operator precedence than OR, so what gets compiled is:

PHP код:
if((Pos_x <= -0.800000)  || (Pos_y <= -0.800000) || (Pos_z <= -0.800000 && anim == 1008)) 
Use brackets to override the default order of operations.

PHP код:
if((Pos_x <= -0.800000  || Pos_y <= -0.800000 || Pos_z <= -0.800000) && anim == 1008
Reply
#7

Still doesn't work. I can use the cheat.
Reply
#8

If I got you right then it means that it ban player if he is laying on vehicle that is in moving?? ako nisam reci sta je tacno
Reply
#9

Correct. U pravu si.
Reply
#10

Then just use this if possible

https://sampwiki.blast.hk/wiki/GetPlayerSurfingVehicleID

If he is surfing and if the is in that animation just make exception there..
Probaj tako.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)