Advertisement
fiki574_CRO

Anti Health Hack v1.1

Dec 14th, 2011
3,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.25 KB | None | 0 0
  1. #include <a_samp> //default include
  2. #include <sscanf2> //sscanf(params,...);
  3. #include <zcmd> //for /checkhh
  4. #define COLOR_RED 0xFF0000FF //color used in messages
  5. #define Admin IsPlayerAdmin //change to your Admin script
  6. #define NewHealthTime 1000 //change if you dont want to check new health after 1 second
  7. #define TakenHealthTime 1000 //change if you dont want to check taken health after 1 second
  8. #define BanHackerTime 1000 //change if you dont want to ban hacker after 1 second
  9. #define BanDialog 0 //number of dialog
  10. #define BanPlayer false //"true" -> it will ban player if he/she has HH | "false" -> it will send message to admin that player might be HHacking
  11. #define Website sampcss //shown in dialog after player banned -> show him/her where to request unban
  12. new target; //player that you are checking
  13. new admin; //admin that is performing cmd
  14. forward CheckNewHealth(); //check health after fall
  15. forward CheckTakenHealth(); //check if target took any damage
  16. forward BanIfHacker(); //finally, checks if target did not lose any health, in other words -> bans hacker
  17. #if defined FILTERSCRIPT
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.     return 1;
  27. }
  28.  
  29. #else
  30.  
  31. main()
  32. {
  33. }
  34.  
  35. #endif
  36.  
  37. public OnGameModeInit()
  38. {
  39.     return 1;
  40. }
  41.  
  42. public OnGameModeExit()
  43. {
  44.     return 1;
  45. }
  46.  
  47. COMMAND:checkhh(playerid, params[])
  48. {
  49.     if(!Admin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be logged in as an RCON administrator to perform this!");
  50.     if(sscanf(params, "u", target)) return SendClientMessage(admin, COLOR_RED, "Correct usage -> /checkhh <playerid>");
  51.     if(!IsPlayerConnected(target)) return SendClientMessage(admin, COLOR_RED, "ERROR: Player was not found!");
  52.     new Float:X;
  53.     new Float:Y;
  54.     new Float:Z;
  55.     GetPlayerPos(target,X,Y,Z);
  56.     SetPlayerPos(target,X,Y,Z+15);
  57.     SetTimer("CheckTakenHealth",TakenHealthTime,false);
  58.     return 1;
  59. }
  60.  
  61. public CheckTakenHealth()
  62. {
  63.     new Float:CurrHealth;
  64.     GetPlayerHealth(target,CurrHealth);
  65.     SetPVarFloat(target,"CurrHealth",CurrHealth);
  66.     SetTimer("CheckNewHealth",NewHealthTime,false);
  67. }
  68.  
  69. public CheckNewHealth()
  70. {
  71.     new Float:NewHealth;
  72.     GetPlayerHealth(target,NewHealth);
  73.     SetPVarFloat(target,"NewHealth",NewHealth);
  74.     SetTimer("BanIfHacker",BanHackerTime,false);
  75. }
  76.  
  77. public BanIfHacker()
  78. {
  79.     #if BanPlayer == true
  80.     if(GetPVarFloat(target,"CurrHealth") == GetPVarFloat(target,"NewHealth"))
  81.     {
  82.         new pname[MAX_PLAYER_NAME];
  83.         new string[256];
  84.         GetPlayerName(target,pname,sizeof(pname));
  85.         format(string,sizeof(string),"[ANTI-CHEAT]: %s has been banned for Health Hacks!",pname);
  86.         SendClientMessageToAll(COLOR_RED,string);
  87.         new baninfo[256];
  88.         format(baninfo,sizeof(baninfo),"You have been banned for Health hacking!\n\nWanna get unbanned? Post at www."#Website#".com!");
  89.         ShowPlayerDialog(target,BanDialog,DIALOG_STYLE_MSGBOX,"BANNED!", baninfo,"OK","");
  90.         BanEx(target,"Health Hack");
  91.     }
  92.     #endif
  93.    
  94.     #if BanPlayer == false
  95.     if(GetPVarFloat(target,"CurrHealth") == GetPVarFloat(target,"NewHealth"))
  96.     {
  97.         new pname[MAX_PLAYER_NAME];
  98.         new string[256];
  99.         GetPlayerName(target,pname,sizeof(pname));
  100.         format(string,sizeof(string),"%s is possible Health Hacker!",pname);
  101.         SendClientMessage(admin,COLOR_RED,string);
  102.     }
  103.     #endif
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement