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 :)
}
// Variables
new acT;
// OnGameModeInit
acT = SetTimer("AntiFly", 1500, true);
// OnGameModeExit
KillTimer(acT);
// function
forward public AntiFly();
public AntiFly()
{
for(new i, l = GetPlayerPoolSize(); i <= l; i++)
{
if(IsPlayerConnected(i))
{
//Fly Hack
new Float:Pos_x, Float:Pos_y, Float:Pos_z, anim = GetPlayerAnimationIndex(i);
GetPlayerVelocity(i, Pos_x, Pos_y, Pos_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;
}
Don't ever use these kinds of stuff in OnPlayerUpdate, use a timer for that.
PHP код:
|
forward AntiFly();
public AntiFly(){
if(!IsPlayerInAnyVehicle(i)){
switch(GetPlayerAnimationIndex(i)){
case 958, 959: {
new wepid, ammo;
GetPlayerWeaponData(i,11,wepid,ammo);
if(wepid != 46){
if(IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
//you code
Kick(i);
return 1;
}
}
}
case 1539, 1058: {
if(IsCollisionFlag(GetPlayerCollisionFlags(i),POSITION_FLAG_AIR)){
//you code
Kick(i);
return 1;
}
}
}
}
return 1;
}
I think it might be more effective.
PHP код:
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.
PHP код:
|
if((Pos_x <= -0.800000) || (Pos_y <= -0.800000) || (Pos_z <= -0.800000 && anim == 1008))
if((Pos_x <= -0.800000 || Pos_y <= -0.800000 || Pos_z <= -0.800000) && anim == 1008)