Advertisement
Guest User

Homer

a guest
Jul 4th, 2008
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.30 KB | None | 0 0
  1. /*
  2. .:: Hack Fighter AntiCheat ::.
  3. .:: Coded by Homer ::.
  4. .:: 2008 ::.
  5. .:: All Rights Reserved ::.
  6. */
  7.  
  8. #include <a_samp>
  9. #include <HFunc>
  10.  
  11. #define FILTERSCRIPT
  12.  
  13. #define ORANGE 0xFF8C00AA
  14. #define GREEN 0x33AA33AA
  15. #define YELLOW 0xFFFF00AA
  16. #define HOMER 0xFF0000AA
  17. #define BLUE 0x33CCFFAA
  18. #define ABLUE 0x2641FEAA
  19.  
  20. new MaxPing;
  21. new IsPlayerSpawned[MAX_PLAYERS];
  22. new DostanePrachy[MAX_PLAYERS];
  23. new StarePrachy[MAX_PLAYERS];
  24.  
  25. forward CheckPing();
  26. forward CheckHacks();
  27.  
  28. public OnFilterScriptInit()
  29. {
  30. print("\n-------------LOADING------------------");
  31. print(" Homer's Hack Fighter by PAWNTeam 2008");
  32. print("--------------------------------------\n");
  33. SetTimer("CheckHacks",2000,1);
  34. SetTimer("CheckPing",5000,1);
  35. MaxPing = 100;
  36. if(!fexist("hf.txt"))
  37. {
  38. print("WARNING! File hf.txt missing from scriptfiles!");
  39. }
  40. return 1;
  41. }
  42.  
  43. public OnFilterScriptExit()
  44. {
  45. print("\n-------------UNLOADING----------------");
  46. print(" Homer's Hack Fighter by PAWNTeam 2008");
  47. print("--------------------------------------\n");
  48. return 1;
  49. }
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53. if(IsPlayerConnected(playerid))
  54. {
  55. IsPlayerSpawned[playerid] = 0;
  56. }
  57. return 1;
  58. }
  59.  
  60. public OnPlayerSpawn(playerid)
  61. {
  62. if(IsPlayerConnected(playerid))
  63. {
  64. IsPlayerSpawned[playerid] = 1;
  65. }
  66. return 1;
  67. }
  68.  
  69. public OnPlayerDeath(playerid, killerid, reason)
  70. {
  71. new pName[MAX_PLAYER_NAME];
  72. new kName[MAX_PLAYER_NAME];
  73. new string[256];
  74.  
  75. GetPlayerName(killerid, kName, sizeof(kName));
  76. GetPlayerName(playerid, pName, sizeof(pName));
  77.  
  78. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  79. {
  80. format(string,256,"[HackFighter] %s[ID:%d] has killed %s[ID:%d] with Drive-By!",kName,killerid,pName,playerid);
  81. KickMessage(string);
  82. }
  83. return 1;
  84. }
  85.  
  86. public OnPlayerCommandText(playerid, cmdtext[])
  87. {
  88. new string[256];
  89. new tmp[256], cmd[256], idx;
  90. cmd = strtok(cmdtext, idx);
  91. new pName[MAX_PLAYER_NAME];
  92.  
  93. if(strcmp(cmd, "/setping",true ) == 0)
  94. {
  95. if(IsPlayerAdmin(playerid))
  96. {
  97. if(IsPlayerConnected(playerid))
  98. {
  99. tmp = strtok(cmdtext, idx);
  100. if(!strlen(tmp))
  101. {
  102. SendClientMessage(playerid,ORANGE,"[HackFighter] USAGE: /setping [MaxPing]");
  103. return 1;
  104. }
  105. if(strval(tmp) < 30 || strval(tmp) > 2000)
  106. {
  107. SendClientMessage(playerid,ORANGE,"[HackFighter] ERROR! Minimum is 30 and Maximum is 2000!");
  108. return 1;
  109. }
  110. MaxPing = strval(tmp);
  111. GetPlayerName(playerid, pName, sizeof(pName));
  112. format(string,256,"[HackFighter] Admin %d[ID:%d] has set the Max ping to %d!",pName,playerid,MaxPing);
  113. SendClientMessageToAll(HOMER,string);
  114. }
  115. }else{
  116. SendClientMessage(playerid,ORANGE,"[HackFighter] You are not Admin!");
  117. return 1;
  118. }
  119. return 1;
  120. }
  121. return 0;
  122. }
  123.  
  124. public CheckPing()
  125. {
  126. for(new i; i < MAX_PLAYERS; i++)
  127. {
  128. if(IsPlayerConnected(i))
  129. {
  130. if(GetPlayerPing(i) >= MaxPing && IsPlayerSpawned[i] == 1)
  131. {
  132. new Year,Month,Day;
  133. new Hour,Min,Sec;
  134. new pName[MAX_PLAYER_NAME];
  135. new string[256];
  136.  
  137. getdate(Year,Month,Day);
  138. gettime(Hour,Min,Sec);
  139.  
  140. GetPlayerName(i, pName, sizeof(pName));
  141. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: High Ping (Max. Allowed: %d)",pName,i,MaxPing);
  142. SendClientMessageToAll(HOMER,string);
  143. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  144. KickMessage(string);
  145. Kick(i);
  146. }
  147. }
  148. }
  149. }
  150.  
  151. public CheckHacks()
  152. {
  153. new pName[MAX_PLAYER_NAME];
  154. new string[256];
  155. new Float:HP,Float:ARM,Float:VehHP;
  156. new Ammo,VID,Money;
  157. new Year,Month,Day;
  158. new Hour,Min,Sec;
  159.  
  160. for(new i; i < MAX_PLAYERS; i++)
  161. {
  162. GetPlayerHealth(i,HP);
  163. GetPlayerArmour(i,ARM);
  164. GetVehicleHealth(VID,VehHP);
  165. Ammo = GetPlayerAmmo(i);
  166. VID = GetPlayerVehicleID(i);
  167. Money = GetPlayerMoney(i);
  168. getdate(Year,Month,Day);
  169. gettime(Hour,Min,Sec);
  170.  
  171. if(IsPlayerConnected(i))
  172. {
  173. if(GetPlayerWeapon(i) == 38) //Minigun
  174. {
  175. GetPlayerName(i, pName, sizeof(pName));
  176. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Not Allowed Weapon (Minigun - %d Ammo)",pName,i,Ammo);
  177. SendClientMessageToAll(HOMER,string);
  178. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  179. KickMessage(string);
  180. Kick(i);
  181. }
  182. if(GetPlayerWeapon(i) == 40) //Detonator
  183. {
  184. GetPlayerName(i, pName, sizeof(pName));
  185. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Not Allowed Weapon (Detonator - %d Ammo)",pName,i,Ammo);
  186. SendClientMessageToAll(HOMER,string);
  187. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  188. KickMessage(string);
  189. Kick(i);
  190. }
  191. if(GetPlayerWeapon(i) == 36) //RPG
  192. {
  193. GetPlayerName(i, pName, sizeof(pName));
  194. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Not Allowed Weapon (RPG - %d Ammo)",pName,i,Ammo);
  195. SendClientMessageToAll(HOMER,string);
  196. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  197. KickMessage(string);
  198. Kick(i);
  199. }
  200. if(GetPlayerWeapon(i) == 35) //Rocket Launcher
  201. {
  202. GetPlayerName(i, pName, sizeof(pName));
  203. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Not Allowed Weapon (Rocket Launcher - %d Ammo)",pName,i,Ammo);
  204. SendClientMessageToAll(HOMER,string);
  205. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  206. KickMessage(string);
  207. Kick(i);
  208. }
  209. if(GetPlayerSpecialAction(i) == 2) //JetPack
  210. {
  211. GetPlayerName(i, pName, sizeof(pName));
  212. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Jet Pack",pName,i);
  213. SendClientMessageToAll(HOMER,string);
  214. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  215. KickMessage(string);
  216. Kick(i);
  217. }
  218. if(HP > 100) //GodMode - Len ak m� health nad 100 - Nepou��va� /god
  219. {
  220. GetPlayerName(i, pName, sizeof(pName));
  221. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: God Mode (%d HP)",pName,i,HP);
  222. SendClientMessageToAll(HOMER,string);
  223. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  224. KickMessage(string);
  225. Kick(i);
  226. }
  227. if(ARM > 100) //GodMode - Len ak m� armour nad 100
  228. {
  229. GetPlayerName(i, pName, sizeof(pName));
  230. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Armour Hack (%d HP)",pName,i,ARM);
  231. SendClientMessageToAll(HOMER,string);
  232. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  233. KickMessage(string);
  234. Kick(i);
  235. }
  236. if(Ammo > 100000) //Viac ako 100000 Ammo - Prenastavte si ako potrebujete
  237. {
  238. GetPlayerName(i, pName, sizeof(pName));
  239. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Ammo Hack (%d Ammo)",pName,i,Ammo);
  240. SendClientMessageToAll(HOMER,string);
  241. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  242. KickMessage(string);
  243. Kick(i);
  244. }
  245. if(GetPlayerMoney(i) > StarePrachy[i] && !DostanePrachy[i]) //Money Cheat - Tak� pokus xD
  246. {
  247. format(string,256,"[HackFighter] %s[ID:%d] has been kicked. Reason: Money Hack ($%d)",pName,i,Money);
  248. SendClientMessageToAll(HOMER,string);
  249. format(string,256,"%s[ID:%d] has been kicked - %d/%d/%d at %d:%d and %d seconds",pName,i,Day,Month,Year,Hour,Min,Sec);
  250. KickMessage(string);
  251. Kick(i);
  252. }
  253. if(VehHP > 1000) //Auto m� viac healthu ako 1000 - Maximum
  254. {
  255. RemovePlayerFromVehicle(i);
  256. DestroyVehicle(VID); //Auto sa proste zni��, preto�e sa nevie ktor� cheater to auto urobil
  257. }
  258. }
  259. }
  260. }
  261.  
  262. stock KickMessage(const string[])
  263. {
  264. new File:HF = fopen("hf.txt",io_append);
  265. fwrite(HF, string);
  266. fclose(HF);
  267. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement