• Страница 1 из 1
  • 1
Модератор форума: [east_side]_trane, drifter-dron, valych, admin  
Форум » Pawno » уроки скрипты » [FS]Anti-cheat (*icon-0*)
[FS]Anti-cheat
adminДата: Вторник, 25.01.2011, 13:05:00 | Сообщение # 1

Группа: Администраторы
Сообщений: 3869
Привет! Это мой первый собственный сценарий.
Ее серверным античит (не готовы на все)

В настоящее время она имеет только следующие функции:

* Основные анти здоровья обмануть
* Основные борьбе брони обмануть
* Airbreak обнаружения использованием MapAndreas карты высот
* Anti Speedhack
* Anti Jetpack

И он задерживается системы запрет, потому что я думаю, что это делает работу мошенников сложнее, когда они не знать, какие рубить вызвало запрет.
Я был бы признателен, если Вы можете проверить особенно airbreak обнаружения.

Херес источника (требуется mapandreas)

Code
/**
/ AHX (AntiHax) Server-side anticheat for SA:MP - Early version
/ Copyright (C) 2011 Duxtray
/ YOU ARE ALLOWED TO USE THIS SCRIPT
/ YOU ARE NOT ALLOWED TO REMOVE OR CHANGE CREDITS OF THIS SCRIPT
/ YOU ARE NOT ALLOWED TO CHANGE SCRIPT'S NAME (ANTIHAX)
/ YOU ARE NOT ALLOWED TO TAKE ANY CHEAT DETECTION SYSTEM DIRECTLY FROM THIS SCRIPT AND CLAIM IT AS YOURS
**/
#include <a_samp>
#include <mapandreas>

// PROTECTION SETTINGS
#define HEALTH      true
// anti health hack

#define HEALTH_SCORE    3
// violation score from hack
//////////////////////////////

#define ARMOUR      true
// anti armour hack

#define ARMOUR_SCORE    3
// violation score from hack
//////////////////////////////

#define JETPACK true
// dont allow jetpack usage

#define JETPACK_SCORE   3
// violation score from hack
//////////////////////////////

#define AIRBREAK    true
// anti airbreak hack

#define AIRBREAK_SCORE  3
// violation score from hack

#define AIRBREAK_TRESHOLD   5.0
// minimal difference in height between player and ground to activate airbreak check
//////////////////////////////

#define SPEEDHACK   true
// speedhack detection

#define SPEEDHACK_SCORE     3
// violation score

#define SH_VEHICLE_SPEED_MAX    300.0
// maximum speed of vehicle before treating as speedhacker

#define SH_PLAYER_SPEED_MAX     50.0
// maximum speed of player on foot before treating as speedhacker
//////////////////////////////

//////////////////////////////

// GENERAL SETTINGS

#define QUIET       true
// dont show any reason in bans/kicks (increases effectivity? cheaters dont know which hack was detected)

#define DELAYED     true
// delayed bans/kicks (increased effectivity?)

#define MIN_DELAY   30
// minimal delay in seconds

#define MAX_DELAY   45
// maximal delay in seconds

#define MAIN_TIMER 1
// time in seconds between main anticheat check

#define ADMIN_IMMUNITY true
// whether rcon admins are immune for punishment

// DONT TOUCH BELOW THIS LINE

#define C_RED   (0xFF0000FF)
#define C_GREEN (0x00FF00FF)
#define C_BLUE  (0x0000FFFF)
#define MESSAGE_PREFIX  "[AHX]"
#define WARN_SCORE      1
#define KICK_SCORE      2
#define BAN_SCORE       3

// Global variables and declarations
new ahx_playerWarningScore[MAX_PLAYERS];
new ahx_skipPlayer[MAX_PLAYERS];
new ahx_playerAirbreakMode[MAX_PLAYERS];
new ahx_playerIP[MAX_PLAYERS][40];

forward ahx_MainTimer();
forward ahx_AirBreakTimer(playerid, opZ);
forward ahx_AirBreakNoclipTimer(playerid, opX, opY, opZ);
forward Float:ahx_GetHighestZFor2DCoord(Float:x, Float:y);
forward Float:ahx_GetLowestZFor2DCoord(Float:x, Float:y);
forward ahx_DelayedAction(playerid, playername[], reason[]);
forward Float:ahx_Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true);
forward Float:ahx_GetPlayerSpeed(playerid, bool:Z = true);
/* SA:MP CALLBACKS */
public OnFilterScriptInit()
{
       print("\n--------------------------------------");
       print(" AntiHax - Anticheat by Duxtray loaded");
       print("--------------------------------------\n");
       MapAndreas_Init(MAP_ANDREAS_MODE_FULL);

       SetTimer("ahx_MainTimer",MAIN_TIMER * 1000,true);
       return 1;
}

public OnFilterScriptExit()
{
       return 1;
}

public OnPlayerConnect(playerid)
{
       new ip[40];
       GetPlayerIp(playerid, ip, 16);
       ahx_playerIP[playerid] = ip;
       ahx_PlayerMessage(playerid, "This server is protected by AntiHax");
       return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
       if (reason == 2) { ahx_playerIP[playerid][0] = 0; return 1; /* own kick/ban */ }
       if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
       {
           new message[100];
           format(message, sizeof(message), "%s: Banned (-)", ahx_PlayerName(playerid));
           ahx_PlayerMessageToEveryone(message);
           print(message);
             
           new bancmd[100];
           format(bancmd, sizeof(bancmd), "banip %s", ahx_playerIP[playerid]);
           SendRconCommand(bancmd);
           ahx_playerWarningScore[playerid] = 0;
       }
       ahx_playerIP[playerid][0] = 0;
       return 1;
}

// AHX functions
public ahx_MainTimer()
{

       for (new i = 0 ; i < MAX_PLAYERS ; i++)
       {
           if (!IsPlayerConnected(i)) continue;
           if (ahx_skipPlayer[i]) continue;
           if (IsPlayerAdmin(i) && ADMIN_IMMUNITY) continue;

           // HEALTH
           if (HEALTH)
           {
               new Float:health;
               GetPlayerHealth(i, health);
               if (health > 100.0) { ahx_TakeAction(i, "Health hack", HEALTH_SCORE); }
           }

           // ARMOR
           if (ARMOUR)
           {
               new Float:armour;
               GetPlayerArmour(i, armour);
               if (armour > 100.0) { ahx_TakeAction(i, "Armour hack", ARMOUR_SCORE); }
           }

           // JETPACK
           if (JETPACK)
           {
               if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
               {
                   ahx_TakeAction(i, "Jetpack", JETPACK_SCORE);
               }
           }

           // AIRBREAK
           if (AIRBREAK)
           {
               new Float:playerX, Float:playerY, Float:playerZ, Float:groundZ, Float:lgroundZ, Float:zDiff, Float:vX, Float:vY, Float:vZ;
               GetPlayerPos(i, playerX, playerY, playerZ);
               GetPlayerVelocity(i, vX, vY, vZ);
               groundZ = ahx_GetHighestZFor2DCoord(playerX, playerY);
               lgroundZ = ahx_GetLowestZFor2DCoord(playerX, playerY);
               zDiff = playerZ-groundZ;
               if (lgroundZ > 0.0 && playerZ < 0.0)
               {
                   ahx_TakeAction(i,"Airbreak",AIRBREAK_SCORE);
               }

               if (zDiff > AIRBREAK_TRESHOLD)
               {
                   if (GetPlayerState(i) != PLAYER_STATE_WASTED)
                       { // dont proceed if dying
                           if (GetPlayerInterior(i) == 0)
                           { // only proceed when at main world
                     if (IsPlayerInAnyVehicle(i))
                     {
                      ahx_playerAirbreakMode[i] = 1;
                      if (!ahx_IsVehicleAirVehicle(GetVehicleModel(GetPlayerVehicleID(i)))) {
                      // wont proceed if inside air vehicle
                      if (GetPlayerState(i) == PLAYER_STATE_DRIVER)
                      { // dont ban passengers (innocent?)
                      ahx_AirBreakCheck(i);
                      }
                      }
                      } else {

                      // on foot and flying?
                      if(GetPlayerSpecialAction(i) != SPECIAL_ACTION_USEJETPACK)
                      {
                      ahx_playerAirbreakMode[i] = 0;
                      ahx_AirBreakCheck(i);
                      }
                      }
                     }
                           }
                       }
           }   

               / / SPEEDHACK
           if (SPEEDHACK)
           {
               new Float:vPlayer;
               vPlayer = ahx_GetPlayerSpeed(i, false);
               if (IsPlayerInAnyVehicle(i))
               {
                   if (vPlayer > SH_VEHICLE_SPEED_MAX)
                   {
                       ahx_TakeAction(i, "Speedhack", SPEEDHACK_SCORE);
                   }
               } else
               {
                   if (vPlayer > SH_PLAYER_SPEED_MAX)
                   {
                       ahx_TakeAction(i, "Speedhack", SPEEDHACK_SCORE);
                   }
               }

           }

       }

}

/* ahx_AirBreakCheck: Airbreak protection*/
stock ahx_AirBreakCheck(playerid)
{
       if (ahx_playerAirbreakMode[playerid] == 0)
       {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetPlayerVelocity(playerid, vX, vY, vZ);

           GetPlayerPos(playerid, pX, pY, pZ);
           SetTimerEx("ahx_AirBreakTimer",500,false,"if",playerid,pZ);
       } else {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
           GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ);
           SetTimerEx("ahx_AirBreakTimer",500,false,"if",playerid,pZ);
       }

}
/* ahx_AirBreakTimer: Timer callback for airbrake protection */
public ahx_AirBreakTimer(playerid, opZ)
{
       if (ahx_playerAirbreakMode[playerid] == 0)
       {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetPlayerVelocity(playerid, vX, vY, vZ);
           GetPlayerPos(playerid, pX, pY, pZ);
           if (vZ >= 0)
           {
               ahx_TakeAction(playerid, "Airbreak", AIRBREAK_SCORE);
           }
       } else{
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
           GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ);
           if (vZ >= 0)
           {
               ahx_TakeAction(playerid, "Airbreak", AIRBREAK_SCORE);
           }

       }
}

/* ahx_IsVehicleAirVehicle: Is vehicle helicopter or airplane */
stock ahx_IsVehicleAirVehicle(vehid)
{
       switch(vehid)
       {
           case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 498, 563, 447, 469: return true;
       }
       return false;
}

/* ahx_TakeAction: Kicks/bans/warns player */
stock ahx_TakeAction(playerid, reason[], score)
{
       if (IsPlayerConnected(playerid))
       {

           ahx_playerWarningScore[playerid] += score;

           if (QUIET)
           {
               reason[0] = '-';
               reason[1] = 0;
           }
           if (DELAYED && ahx_playerWarningScore[playerid] > WARN_SCORE)
           {
               new rand = MIN_DELAY+random(MAX_DELAY-MIN_DELAY);
               SetTimerEx("ahx_DelayedAction", rand*1000, false, "iss",playerid, ahx_PlayerName(playerid), reason);
               ahx_skipPlayer[playerid] = true;
               return;
           }
           if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
           {

               new message[100];
               format(message, sizeof(message), "You have been banned (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Banned (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Ban(playerid);
               ahx_playerWarningScore[playerid] = 0;
               return;

           }
           if (ahx_playerWarningScore[playerid] >= KICK_SCORE)
           {

               new message[100];
               format(message, sizeof(message), "You have been kicked (%s)", reason);
               ahx_PlayerMessage(playerid, message);

               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Kicked (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Kick(playerid);
               return;
           }
           if (ahx_playerWarningScore[playerid] >= WARN_SCORE)
           {
               new message[100];
               format(message, sizeof(message), "Warning! Do not violate rules (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               return;
           }

       }
}

public ahx_DelayedAction(playerid, playername[], reason[])
{
       if (strcmp(playername, ahx_PlayerName(playerid)) != 0)
       { // cheater disconnected before this ?! lets not ban innocent people
           return;
       }
       if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
       {

               new message[100];
               format(message, sizeof(message), "You have been banned (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Banned (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Ban(playerid);
               ahx_playerWarningScore[playerid] = 0;
               return;
       }
       if (ahx_playerWarningScore[playerid] >= KICK_SCORE)
       {

           new message[100];
           format(message, sizeof(message), "You have been kicked (%s)", reason);
           ahx_PlayerMessage(playerid, message);

           new gmessage[100];
           format(gmessage, sizeof(gmessage), "%s: Kicked (%s)", ahx_PlayerName(playerid), reason);
           ahx_PlayerMessageToEveryone(gmessage);
           Kick(playerid);
           return;
       }
       if (ahx_playerWarningScore[playerid] >= WARN_SCORE)
       {
           new message[100];
           format(message, sizeof(message), "Warning! Do not violate rules (%s)", reason);
           ahx_PlayerMessage(playerid, message);
           return;
       }
}

/* ahx_PlayerMessage: Send message to player */
stock ahx_PlayerMessage(playerid, message[])
{
       if (IsPlayerConnected(playerid))
       {
           new msg[100];
           format(msg, sizeof(msg), "%s: %s", MESSAGE_PREFIX, message);
           SendClientMessage(playerid, C_GREEN, msg);
       }
}

/* ahx_PlayerMessageToEveryone: Send message to all players */
stock ahx_PlayerMessageToEveryone(message[])
{
           new msg[100];
           format(msg, sizeof(msg), "%s: %s", MESSAGE_PREFIX, message);
           SendClientMessageToAll(C_GREEN, msg);
}
/* ahx_BubbleSort: Sort array with bubble sort algorithm*/
stock ahx_BubbleSort(Float:array[], length)
{
       new i,j;
       for(i=0 ; i<length ; i++)
       {
           for(j=0 ; j<i ; j++)
           {
               if(array[i]>array[j])
               {
                   new Float:temp=array[i];
                   array[i]=array[j];
                   array[j]=temp;
               }

           }

       }
}

/* ahx_PlayerName: Get player name easily */
stock ahx_PlayerName(playerid)
{
       new name[MAX_PLAYER_NAME];
       GetPlayerName(playerid, name, sizeof(name));
       return name;
}
/* ahx_GetHighestZFor2DCoord: Get Z coordinate for ground at specified point with MapAndreas but detect whether coordinate for ex. edge of roof */
stock Float:ahx_GetHighestZFor2DCoord(Float:x, Float:y)
{
       new Float:coords[5], Float:temp;

       MapAndreas_FindZ_For2DCoord(x,y,temp);
       coords[0] = temp;
       MapAndreas_FindZ_For2DCoord(x+3,y,temp);
       coords[1] = temp;
       MapAndreas_FindZ_For2DCoord(x,y+3,temp);
       coords[2] = temp;
       MapAndreas_FindZ_For2DCoord(x-3,y,temp);
       coords[3] = temp;
       MapAndreas_FindZ_For2DCoord(x,y-3,temp);
       coords[4] = temp;

       ahx_BubbleSort(coords,5);
       new Float:result = coords[0];
       return result;
}
/* ahx_GetLowestZFor2DCoord: Get Z coordinate for ground at specified point with MapAndreas but detect whether coordinate for ex. edge of roof */
stock Float:ahx_GetLowestZFor2DCoord(Float:x, Float:y)
{
       new Float:coords[5], Float:temp;

       MapAndreas_FindZ_For2DCoord(x,y,temp);
       coords[0] = temp;
       MapAndreas_FindZ_For2DCoord(x+3,y,temp);
       coords[1] = temp;
       MapAndreas_FindZ_For2DCoord(x,y+3,temp);
       coords[2] = temp;
       MapAndreas_FindZ_For2DCoord(x-3,y,temp);
       coords[3] = temp;
       MapAndreas_FindZ_For2DCoord(x,y-3,temp);
       coords[4] = temp;

       ahx_BubbleSort(coords,5);
       new Float:result = coords[4];
       return result;
}
/* ahx_Distance2D: Get distance between two 2D coordinates*/
stock Float:ahx_Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true)
{
     x1 -= x2;
     x1 *= x1;

     y1 -= y2;
     y1 *= y1;

     x1 += y1;

     return sqrt ? floatsqroot(x1) : x1;
}

/* ahx_GetPlayerSpeed: Get player speed in km/h */
stock Float:ahx_GetPlayerSpeed(playerid, bool:Z = true)
{
       new Float:SpeedX, Float:SpeedY, Float:SpeedZ;
       new Float:Speed;
       if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), SpeedX, SpeedY, SpeedZ);
       else GetPlayerVelocity(playerid, SpeedX, SpeedY, SpeedZ);
       if(Z) Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatadd(floatpower(SpeedY, 2.0), floatpower(SpeedZ, 2.0))));
       else Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0)));
       Speed = floatround(Speed * 100 * 1.61);
       return Speed;
}

Источник:sa-mp.com


zm-jail.ru

Разработка сайта samp-pawno.ru


 
СообщениеПривет! Это мой первый собственный сценарий.
Ее серверным античит (не готовы на все)

В настоящее время она имеет только следующие функции:

* Основные анти здоровья обмануть
* Основные борьбе брони обмануть
* Airbreak обнаружения использованием MapAndreas карты высот
* Anti Speedhack
* Anti Jetpack

И он задерживается системы запрет, потому что я думаю, что это делает работу мошенников сложнее, когда они не знать, какие рубить вызвало запрет.
Я был бы признателен, если Вы можете проверить особенно airbreak обнаружения.

Херес источника (требуется mapandreas)

Code
/**
/ AHX (AntiHax) Server-side anticheat for SA:MP - Early version
/ Copyright (C) 2011 Duxtray
/ YOU ARE ALLOWED TO USE THIS SCRIPT
/ YOU ARE NOT ALLOWED TO REMOVE OR CHANGE CREDITS OF THIS SCRIPT
/ YOU ARE NOT ALLOWED TO CHANGE SCRIPT'S NAME (ANTIHAX)
/ YOU ARE NOT ALLOWED TO TAKE ANY CHEAT DETECTION SYSTEM DIRECTLY FROM THIS SCRIPT AND CLAIM IT AS YOURS
**/
#include <a_samp>
#include <mapandreas>

// PROTECTION SETTINGS
#define HEALTH      true
// anti health hack

#define HEALTH_SCORE    3
// violation score from hack
//////////////////////////////

#define ARMOUR      true
// anti armour hack

#define ARMOUR_SCORE    3
// violation score from hack
//////////////////////////////

#define JETPACK true
// dont allow jetpack usage

#define JETPACK_SCORE   3
// violation score from hack
//////////////////////////////

#define AIRBREAK    true
// anti airbreak hack

#define AIRBREAK_SCORE  3
// violation score from hack

#define AIRBREAK_TRESHOLD   5.0
// minimal difference in height between player and ground to activate airbreak check
//////////////////////////////

#define SPEEDHACK   true
// speedhack detection

#define SPEEDHACK_SCORE     3
// violation score

#define SH_VEHICLE_SPEED_MAX    300.0
// maximum speed of vehicle before treating as speedhacker

#define SH_PLAYER_SPEED_MAX     50.0
// maximum speed of player on foot before treating as speedhacker
//////////////////////////////

//////////////////////////////

// GENERAL SETTINGS

#define QUIET       true
// dont show any reason in bans/kicks (increases effectivity? cheaters dont know which hack was detected)

#define DELAYED     true
// delayed bans/kicks (increased effectivity?)

#define MIN_DELAY   30
// minimal delay in seconds

#define MAX_DELAY   45
// maximal delay in seconds

#define MAIN_TIMER 1
// time in seconds between main anticheat check

#define ADMIN_IMMUNITY true
// whether rcon admins are immune for punishment

// DONT TOUCH BELOW THIS LINE

#define C_RED   (0xFF0000FF)
#define C_GREEN (0x00FF00FF)
#define C_BLUE  (0x0000FFFF)
#define MESSAGE_PREFIX  "[AHX]"
#define WARN_SCORE      1
#define KICK_SCORE      2
#define BAN_SCORE       3

// Global variables and declarations
new ahx_playerWarningScore[MAX_PLAYERS];
new ahx_skipPlayer[MAX_PLAYERS];
new ahx_playerAirbreakMode[MAX_PLAYERS];
new ahx_playerIP[MAX_PLAYERS][40];

forward ahx_MainTimer();
forward ahx_AirBreakTimer(playerid, opZ);
forward ahx_AirBreakNoclipTimer(playerid, opX, opY, opZ);
forward Float:ahx_GetHighestZFor2DCoord(Float:x, Float:y);
forward Float:ahx_GetLowestZFor2DCoord(Float:x, Float:y);
forward ahx_DelayedAction(playerid, playername[], reason[]);
forward Float:ahx_Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true);
forward Float:ahx_GetPlayerSpeed(playerid, bool:Z = true);
/* SA:MP CALLBACKS */
public OnFilterScriptInit()
{
       print("\n--------------------------------------");
       print(" AntiHax - Anticheat by Duxtray loaded");
       print("--------------------------------------\n");
       MapAndreas_Init(MAP_ANDREAS_MODE_FULL);

       SetTimer("ahx_MainTimer",MAIN_TIMER * 1000,true);
       return 1;
}

public OnFilterScriptExit()
{
       return 1;
}

public OnPlayerConnect(playerid)
{
       new ip[40];
       GetPlayerIp(playerid, ip, 16);
       ahx_playerIP[playerid] = ip;
       ahx_PlayerMessage(playerid, "This server is protected by AntiHax");
       return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
       if (reason == 2) { ahx_playerIP[playerid][0] = 0; return 1; /* own kick/ban */ }
       if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
       {
           new message[100];
           format(message, sizeof(message), "%s: Banned (-)", ahx_PlayerName(playerid));
           ahx_PlayerMessageToEveryone(message);
           print(message);
             
           new bancmd[100];
           format(bancmd, sizeof(bancmd), "banip %s", ahx_playerIP[playerid]);
           SendRconCommand(bancmd);
           ahx_playerWarningScore[playerid] = 0;
       }
       ahx_playerIP[playerid][0] = 0;
       return 1;
}

// AHX functions
public ahx_MainTimer()
{

       for (new i = 0 ; i < MAX_PLAYERS ; i++)
       {
           if (!IsPlayerConnected(i)) continue;
           if (ahx_skipPlayer[i]) continue;
           if (IsPlayerAdmin(i) && ADMIN_IMMUNITY) continue;

           // HEALTH
           if (HEALTH)
           {
               new Float:health;
               GetPlayerHealth(i, health);
               if (health > 100.0) { ahx_TakeAction(i, "Health hack", HEALTH_SCORE); }
           }

           // ARMOR
           if (ARMOUR)
           {
               new Float:armour;
               GetPlayerArmour(i, armour);
               if (armour > 100.0) { ahx_TakeAction(i, "Armour hack", ARMOUR_SCORE); }
           }

           // JETPACK
           if (JETPACK)
           {
               if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
               {
                   ahx_TakeAction(i, "Jetpack", JETPACK_SCORE);
               }
           }

           // AIRBREAK
           if (AIRBREAK)
           {
               new Float:playerX, Float:playerY, Float:playerZ, Float:groundZ, Float:lgroundZ, Float:zDiff, Float:vX, Float:vY, Float:vZ;
               GetPlayerPos(i, playerX, playerY, playerZ);
               GetPlayerVelocity(i, vX, vY, vZ);
               groundZ = ahx_GetHighestZFor2DCoord(playerX, playerY);
               lgroundZ = ahx_GetLowestZFor2DCoord(playerX, playerY);
               zDiff = playerZ-groundZ;
               if (lgroundZ > 0.0 && playerZ < 0.0)
               {
                   ahx_TakeAction(i,"Airbreak",AIRBREAK_SCORE);
               }

               if (zDiff > AIRBREAK_TRESHOLD)
               {
                   if (GetPlayerState(i) != PLAYER_STATE_WASTED)
                       { // dont proceed if dying
                           if (GetPlayerInterior(i) == 0)
                           { // only proceed when at main world
                     if (IsPlayerInAnyVehicle(i))
                     {
                      ahx_playerAirbreakMode[i] = 1;
                      if (!ahx_IsVehicleAirVehicle(GetVehicleModel(GetPlayerVehicleID(i)))) {
                      // wont proceed if inside air vehicle
                      if (GetPlayerState(i) == PLAYER_STATE_DRIVER)
                      { // dont ban passengers (innocent?)
                      ahx_AirBreakCheck(i);
                      }
                      }
                      } else {

                      // on foot and flying?
                      if(GetPlayerSpecialAction(i) != SPECIAL_ACTION_USEJETPACK)
                      {
                      ahx_playerAirbreakMode[i] = 0;
                      ahx_AirBreakCheck(i);
                      }
                      }
                     }
                           }
                       }
           }   

               / / SPEEDHACK
           if (SPEEDHACK)
           {
               new Float:vPlayer;
               vPlayer = ahx_GetPlayerSpeed(i, false);
               if (IsPlayerInAnyVehicle(i))
               {
                   if (vPlayer > SH_VEHICLE_SPEED_MAX)
                   {
                       ahx_TakeAction(i, "Speedhack", SPEEDHACK_SCORE);
                   }
               } else
               {
                   if (vPlayer > SH_PLAYER_SPEED_MAX)
                   {
                       ahx_TakeAction(i, "Speedhack", SPEEDHACK_SCORE);
                   }
               }

           }

       }

}

/* ahx_AirBreakCheck: Airbreak protection*/
stock ahx_AirBreakCheck(playerid)
{
       if (ahx_playerAirbreakMode[playerid] == 0)
       {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetPlayerVelocity(playerid, vX, vY, vZ);

           GetPlayerPos(playerid, pX, pY, pZ);
           SetTimerEx("ahx_AirBreakTimer",500,false,"if",playerid,pZ);
       } else {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
           GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ);
           SetTimerEx("ahx_AirBreakTimer",500,false,"if",playerid,pZ);
       }

}
/* ahx_AirBreakTimer: Timer callback for airbrake protection */
public ahx_AirBreakTimer(playerid, opZ)
{
       if (ahx_playerAirbreakMode[playerid] == 0)
       {
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetPlayerVelocity(playerid, vX, vY, vZ);
           GetPlayerPos(playerid, pX, pY, pZ);
           if (vZ >= 0)
           {
               ahx_TakeAction(playerid, "Airbreak", AIRBREAK_SCORE);
           }
       } else{
           new Float:vX, Float:vY, Float: vZ, Float:pX, Float:pY, Float:pZ;
           GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
           GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ);
           if (vZ >= 0)
           {
               ahx_TakeAction(playerid, "Airbreak", AIRBREAK_SCORE);
           }

       }
}

/* ahx_IsVehicleAirVehicle: Is vehicle helicopter or airplane */
stock ahx_IsVehicleAirVehicle(vehid)
{
       switch(vehid)
       {
           case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 498, 563, 447, 469: return true;
       }
       return false;
}

/* ahx_TakeAction: Kicks/bans/warns player */
stock ahx_TakeAction(playerid, reason[], score)
{
       if (IsPlayerConnected(playerid))
       {

           ahx_playerWarningScore[playerid] += score;

           if (QUIET)
           {
               reason[0] = '-';
               reason[1] = 0;
           }
           if (DELAYED && ahx_playerWarningScore[playerid] > WARN_SCORE)
           {
               new rand = MIN_DELAY+random(MAX_DELAY-MIN_DELAY);
               SetTimerEx("ahx_DelayedAction", rand*1000, false, "iss",playerid, ahx_PlayerName(playerid), reason);
               ahx_skipPlayer[playerid] = true;
               return;
           }
           if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
           {

               new message[100];
               format(message, sizeof(message), "You have been banned (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Banned (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Ban(playerid);
               ahx_playerWarningScore[playerid] = 0;
               return;

           }
           if (ahx_playerWarningScore[playerid] >= KICK_SCORE)
           {

               new message[100];
               format(message, sizeof(message), "You have been kicked (%s)", reason);
               ahx_PlayerMessage(playerid, message);

               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Kicked (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Kick(playerid);
               return;
           }
           if (ahx_playerWarningScore[playerid] >= WARN_SCORE)
           {
               new message[100];
               format(message, sizeof(message), "Warning! Do not violate rules (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               return;
           }

       }
}

public ahx_DelayedAction(playerid, playername[], reason[])
{
       if (strcmp(playername, ahx_PlayerName(playerid)) != 0)
       { // cheater disconnected before this ?! lets not ban innocent people
           return;
       }
       if (ahx_playerWarningScore[playerid] >= BAN_SCORE)
       {

               new message[100];
               format(message, sizeof(message), "You have been banned (%s)", reason);
               ahx_PlayerMessage(playerid, message);
               new gmessage[100];
               format(gmessage, sizeof(gmessage), "%s: Banned (%s)", ahx_PlayerName(playerid), reason);
               ahx_PlayerMessageToEveryone(gmessage);
               Ban(playerid);
               ahx_playerWarningScore[playerid] = 0;
               return;
       }
       if (ahx_playerWarningScore[playerid] >= KICK_SCORE)
       {

           new message[100];
           format(message, sizeof(message), "You have been kicked (%s)", reason);
           ahx_PlayerMessage(playerid, message);

           new gmessage[100];
           format(gmessage, sizeof(gmessage), "%s: Kicked (%s)", ahx_PlayerName(playerid), reason);
           ahx_PlayerMessageToEveryone(gmessage);
           Kick(playerid);
           return;
       }
       if (ahx_playerWarningScore[playerid] >= WARN_SCORE)
       {
           new message[100];
           format(message, sizeof(message), "Warning! Do not violate rules (%s)", reason);
           ahx_PlayerMessage(playerid, message);
           return;
       }
}

/* ahx_PlayerMessage: Send message to player */
stock ahx_PlayerMessage(playerid, message[])
{
       if (IsPlayerConnected(playerid))
       {
           new msg[100];
           format(msg, sizeof(msg), "%s: %s", MESSAGE_PREFIX, message);
           SendClientMessage(playerid, C_GREEN, msg);
       }
}

/* ahx_PlayerMessageToEveryone: Send message to all players */
stock ahx_PlayerMessageToEveryone(message[])
{
           new msg[100];
           format(msg, sizeof(msg), "%s: %s", MESSAGE_PREFIX, message);
           SendClientMessageToAll(C_GREEN, msg);
}
/* ahx_BubbleSort: Sort array with bubble sort algorithm*/
stock ahx_BubbleSort(Float:array[], length)
{
       new i,j;
       for(i=0 ; i<length ; i++)
       {
           for(j=0 ; j<i ; j++)
           {
               if(array[i]>array[j])
               {
                   new Float:temp=array[i];
                   array[i]=array[j];
                   array[j]=temp;
               }

           }

       }
}

/* ahx_PlayerName: Get player name easily */
stock ahx_PlayerName(playerid)
{
       new name[MAX_PLAYER_NAME];
       GetPlayerName(playerid, name, sizeof(name));
       return name;
}
/* ahx_GetHighestZFor2DCoord: Get Z coordinate for ground at specified point with MapAndreas but detect whether coordinate for ex. edge of roof */
stock Float:ahx_GetHighestZFor2DCoord(Float:x, Float:y)
{
       new Float:coords[5], Float:temp;

       MapAndreas_FindZ_For2DCoord(x,y,temp);
       coords[0] = temp;
       MapAndreas_FindZ_For2DCoord(x+3,y,temp);
       coords[1] = temp;
       MapAndreas_FindZ_For2DCoord(x,y+3,temp);
       coords[2] = temp;
       MapAndreas_FindZ_For2DCoord(x-3,y,temp);
       coords[3] = temp;
       MapAndreas_FindZ_For2DCoord(x,y-3,temp);
       coords[4] = temp;

       ahx_BubbleSort(coords,5);
       new Float:result = coords[0];
       return result;
}
/* ahx_GetLowestZFor2DCoord: Get Z coordinate for ground at specified point with MapAndreas but detect whether coordinate for ex. edge of roof */
stock Float:ahx_GetLowestZFor2DCoord(Float:x, Float:y)
{
       new Float:coords[5], Float:temp;

       MapAndreas_FindZ_For2DCoord(x,y,temp);
       coords[0] = temp;
       MapAndreas_FindZ_For2DCoord(x+3,y,temp);
       coords[1] = temp;
       MapAndreas_FindZ_For2DCoord(x,y+3,temp);
       coords[2] = temp;
       MapAndreas_FindZ_For2DCoord(x-3,y,temp);
       coords[3] = temp;
       MapAndreas_FindZ_For2DCoord(x,y-3,temp);
       coords[4] = temp;

       ahx_BubbleSort(coords,5);
       new Float:result = coords[4];
       return result;
}
/* ahx_Distance2D: Get distance between two 2D coordinates*/
stock Float:ahx_Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true)
{
     x1 -= x2;
     x1 *= x1;

     y1 -= y2;
     y1 *= y1;

     x1 += y1;

     return sqrt ? floatsqroot(x1) : x1;
}

/* ahx_GetPlayerSpeed: Get player speed in km/h */
stock Float:ahx_GetPlayerSpeed(playerid, bool:Z = true)
{
       new Float:SpeedX, Float:SpeedY, Float:SpeedZ;
       new Float:Speed;
       if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), SpeedX, SpeedY, SpeedZ);
       else GetPlayerVelocity(playerid, SpeedX, SpeedY, SpeedZ);
       if(Z) Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatadd(floatpower(SpeedY, 2.0), floatpower(SpeedZ, 2.0))));
       else Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0)));
       Speed = floatround(Speed * 100 * 1.61);
       return Speed;
}

Источник:sa-mp.com

Автор - admin
Дата добавления - 25.01.2011 в 13:05:00
valychДата: Вторник, 25.01.2011, 18:37:11 | Сообщение # 2

Группа: Проверенные
Сообщений: 501
Анти-Нах xDDD
Кто придумал это название ??


Видео-уроки по pawn:
https://www.youtube.com/channel/UCizhZElk8rxIPEcP4BHwdxg
 
СообщениеАнти-Нах xDDD
Кто придумал это название ??

Автор - valych
Дата добавления - 25.01.2011 в 18:37:11
adminДата: Среда, 26.01.2011, 00:53:59 | Сообщение # 3

Группа: Администраторы
Сообщений: 3869
valych, тот кто создал тему :D тему подправил :D


zm-jail.ru

Разработка сайта samp-pawno.ru


 
Сообщениеvalych, тот кто создал тему :D тему подправил :D

Автор - admin
Дата добавления - 26.01.2011 в 00:53:59
NeaKTIVДата: Понедельник, 01.08.2011, 09:31:27 | Сообщение # 4

Группа: Пользователи
Сообщений: 30
а скажи мне, где взять этот инклуд?)
 
Сообщениеа скажи мне, где взять этот инклуд?)

Автор - NeaKTIV
Дата добавления - 01.08.2011 в 09:31:27
JinДата: Воскресенье, 07.08.2011, 19:19:32 | Сообщение # 5

Группа: Пользователи
Сообщений: 98
админ а мне нужен только анти чит на оружия и на моней хак скинь плз!
 
Сообщениеадмин а мне нужен только анти чит на оружия и на моней хак скинь плз!

Автор - Jin
Дата добавления - 07.08.2011 в 19:19:32
adminДата: Понедельник, 08.08.2011, 20:19:39 | Сообщение # 6

Группа: Администраторы
Сообщений: 3869
NeaKTIV, какой инклуд? Jin, урок есть ищи и юзайте поиск на форуме!


zm-jail.ru

Разработка сайта samp-pawno.ru


 
СообщениеNeaKTIV, какой инклуд? Jin, урок есть ищи и юзайте поиск на форуме!

Автор - admin
Дата добавления - 08.08.2011 в 20:19:39
Форум » Pawno » уроки скрипты » [FS]Anti-cheat (*icon-0*)
  • Страница 1 из 1
  • 1
Поиск:
Загрузка страницы, займет меньше минуты...
Загрузка...

Статистика Форума
Последнии темы Читаемые темы Лучшие пользователи Новые пользователи
Система телефонов поломалась
Не в себе
фильм скалайн
Трансформеры 3
форсаж 6
Ищу [FS]Для админок на сервер
нужны координаты карты для отметки зон...
Помогите найти мод
pawno урок автоматические ворота
обращение к скриптерам.
Вопросы по скриптингу
Ваши ошибки при компиляции GM/FS

Вопросы по скриптингу

(1081)

Считаем до 1000

(274)

Ваши ошибки при компиляция gm

(260)

Набор в команду

(80)

Ваши ошибки при компиляции GM/FS

(71)

вопроосы по скриптингу от 22.04.2013

(64)

Баннеробмен

(64)

несколько команд на samp 0.3 c

(64)

Оценки сайта samp-pawno.ru

(55)

Заказ хостинга

(51)

Набор в команду(форум)

(45)

Урок №61 по созданию системы авто для GodFather

(45)

admin

(3869)

[east_side]_trane

(443)

TWiX

(316)

valych

(501)

drifter-dron

(477)

danik_rok

(317)

Dimka_71rus

(360)

Drifter96

(300)

MaNb9K

(220)

[MTA]MaPeR5518

(181)

Dima_Tkach

(107)

Nik_Ull

(184)

system32xzxz

(Четверг 09:25:24)

torbin169

(Суббота 23:09:29)

kuchuk_00

(Суббота 17:10:14)

artem_boyko_3

(Суббота 15:57:37)

greggelbak

(Среда 18:29:37)

vladisvlavs

(Среда 13:51:57)

add02102002

(Понедельник 22:37:15)

Диман221

(Понедельник 18:12:45)

almas051004

(Воскресенье 11:05:32)

megasuccessms

(Суббота 14:15:36)

nawe

(Пятница 22:25:23)

swoysb

(Пятница 14:55:29)

Вверх
11:49:19
ОбновитьСмайлыУправление мини-чатом
ЧАТ-PAWNO
2010-2024

vkontakte :samp-pawno.ru: