Advertisement
Guest User

FairPlay.inc

a guest
Jul 6th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.09 KB | None | 0 0
  1. //----------------------------------------------------------------------------------------------------------------.
  2. // //
  3. // Created by Ricky Phelps (SuperViper) //
  4. // //
  5. //------------------------------------------------------------------------------------------------------------//
  6. //-----------------------------------------------------------------------------------------------------------//
  7. // //
  8. // Credits //
  9. // - Scripting: Ricky Phelps //
  10. // - Beta Testing: Chriham3/Alex Shock //
  11. // //
  12. //-----------------------------------------------------------------------------------------------------//
  13. //----------------------------------------------------------------------------------------------------//
  14. // ============================================ SETTINGS =========================================== //
  15.  
  16. /* Unfair play list (comment the line of anything you don't want to be detected) */
  17. #define FP_HIGH_PING (1)
  18. #define FP_WEAPON_HACK (2)
  19. #define FP_VEHICLE_SPEED_HACK (3)
  20. #define FP_JETPACK_HACK (4)
  21. #define FP_DRIVER_DRIVEBY (5) // Commenting this will ENABLE driver driveby
  22. #define FP_DRIVEBY_WEAPONS_RESTRICT (6)
  23. #define FP_SWEARING (7)
  24. #define FP_FLY_HACK (8)
  25. #define FP_CHAT_SPAM (9)
  26. #define FP_AFK (10)
  27. #define FP_TABBING (11)
  28. #define FP_NINJA_JACK (12)
  29. #define FP_CAR_RAM (13)
  30. #define FP_HELIBLADE (14)
  31. #define FP_VEHICLE_MOD_HACK (15)
  32. #define FP_SERVER_AD (16)
  33. #define FP_FAKE_KILL (17)
  34. #define FP_TELEPORT_HACK (18)
  35.  
  36. /* This is the interval of the timer which checks for fair play */
  37. #define FP_TIMER_INTERVAL (1250)
  38.  
  39. /* The maximum ping allowed on the server (will be ignored if high ping detection is disabled) */
  40. #define FP_MAX_PING (500)
  41.  
  42. /* The weapons which are allowed for drivebys (separate with space - will be ignored if driveby weapons restriction is disabled) */
  43. #define FP_DRIVEBY_WEAPONS "28 29 32"
  44.  
  45. /* The IP address of your server (will be ignored if server advertisement detection is disabled) */
  46. #define FP_SERVER_IP "127.0.0.1"
  47.  
  48. /* The domain of your server (will be ignored if server advertisement detection is disabled) */
  49. #define FP_SERVER_DOMAIN "samp.servername.com"
  50.  
  51. /* Curse words (will be ignored if swearing detection is disabled) */
  52. new FP_CurseWords[][] =
  53. {
  54. "ass", "bitch", "cunt", "fuck", "nigga", "nigger", "shit", "whore"
  55. };
  56.  
  57. // ================================================================================================= //
  58. // =============================== DO NOT TOUCH ANYTHING BELOW THIS =============================== //
  59. // =============================================================================================== //
  60.  
  61. #define FAIRPLAY_INCLUDED
  62.  
  63. forward public FP_Detection(playerid);
  64. forward public OnPlayerUnfairPlay(playerid, playType);
  65.  
  66. forward public FP_ReduceChatCounter(playerid);
  67. forward public FP_VehicleJackCheck(playerid);
  68.  
  69. forward public FP_OnPlayerConnect(playerid);
  70. forward public FP_OnPlayerDisconnect(playerid, reason);
  71. forward public FP_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
  72. forward public FP_OnPlayerDeath(playerid, killerid, reason);
  73. forward public FP_OnPlayerSpawn(playerid);
  74. forward public FP_OnPlayerStateChange(playerid, newstate, oldstate);
  75. forward public FP_OnPlayerText(playerid, text[]);
  76. forward public FP_OnPlayerUpdate(playerid);
  77. forward public FP_OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid);
  78. forward public FP_OnVehicleMod(playerid, vehicleid, componentid);
  79. forward public FP_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
  80.  
  81. new FP_PlayerDetectionTimer[MAX_PLAYERS];
  82. new FP_PlayerWeapons[MAX_PLAYERS][13];
  83.  
  84. new FP_WeaponSlots[47] =
  85. {
  86. 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10,
  87. 10, 10, 10, 10, 8, 8, 8, -1, -1, -1,
  88. 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6,
  89. 6, 7, 7, 7, 7, 8, 12, 9, 9, 9, 11,
  90. 11, 11
  91. };
  92.  
  93. new bool: FP_Immune[MAX_PLAYERS];
  94.  
  95. new FP_PingWarnings[MAX_PLAYERS];
  96. new bool: FP_PlayerJetpack[MAX_PLAYERS];
  97. new FP_ChatCounter[MAX_PLAYERS];
  98. new FP_LastUpdate[MAX_PLAYERS], Float: FP_LastPosition[MAX_PLAYERS][3];
  99. new FP_TabbedUpdates[MAX_PLAYERS];
  100. new FP_VehicleJacker[MAX_PLAYERS], FP_VehicleJackTimer[MAX_PLAYERS];
  101. new FP_LastPositionSet[MAX_PLAYERS];
  102.  
  103. stock SetPlayerFairPlayImmune(playerid, bool: immune)
  104. {
  105. return FP_Immune[playerid] = immune;
  106. }
  107.  
  108. FP_GetVehicleSpeed(vehicleID)
  109. {
  110. new Float: vehiclesVelocity[3];
  111. GetVehicleVelocity(vehicleID, vehiclesVelocity[0], vehiclesVelocity[1], vehiclesVelocity[2]);
  112. return floatround(floatsqroot((vehiclesVelocity[0] * vehiclesVelocity[1] + vehiclesVelocity[2] * vehiclesVelocity[2])) * 100 * 1.6);
  113. }
  114.  
  115. FP_GetHighestWaterLevel(playerid)
  116. {
  117. if(IsPlayerInRangeOfPoint(playerid, 50.0, 1962.15, -1198.71, 17.45)) return 19;
  118. if(IsPlayerInRangeOfPoint(playerid, 100.0, -1127.58, 2764.43, 40.00)) return 43;
  119. if(IsPlayerInRangeOfPoint(playerid, 100.0, -988.19, 2486.89, 40.00)) return 43;
  120. if(IsPlayerInRangeOfPoint(playerid, 100.0, -924.33, 2306.59, 40.00)) return 43;
  121. if(IsPlayerInRangeOfPoint(playerid, 100.0, -1104.15, 2175.83, 40.00)) return 43;
  122. if(IsPlayerInRangeOfPoint(playerid, 100.0, -1307.06, 2119.33, 40.00)) return 43;
  123. if(IsPlayerInRangeOfPoint(playerid, 100.0, -831.85, 2122.23, 40.00)) return 43;
  124. if(IsPlayerInRangeOfPoint(playerid, 100.0, -595.76, 2138.34, 40.00)) return 43;
  125. if(IsPlayerInRangeOfPoint(playerid, 100.0, -569.24, 2274.40, 40.00)) return 43;
  126. if(IsPlayerInRangeOfPoint(playerid, 12.0, 1095.800, -674.950, 111.908)) return 113;
  127. if(IsPlayerInRangeOfPoint(playerid, 12.0, 224.500, -1185.725, 73.908)) return 76;
  128. if(IsPlayerInRangeOfPoint(playerid, 12.0, 193.700, -1230.608, 76.603)) return 79;
  129. if(IsPlayerInRangeOfPoint(playerid, 12.0, 1277.500, -805.200, 86.581)) return 88;
  130. if(IsPlayerInRangeOfPoint(playerid, 12.0, 2582.0, 2387.0, 16.0)) return 18;
  131. return 10;
  132. }
  133.  
  134. public FP_Detection(playerid)
  135. {
  136. if(!FP_Immune[playerid])
  137. {
  138. new Float: playersPosition[3], playersState = GetPlayerState(playerid);
  139. GetPlayerPos(playerid, playersPosition[0], playersPosition[1], playersPosition[2]);
  140.  
  141. #if defined FP_TELEPORT_HACK
  142. if(playersState == PLAYER_STATE_ONFOOT || playersState == PLAYER_STATE_DRIVER || playersState == PLAYER_STATE_PASSENGER || playersState == PLAYER_STATE_SPAWNED)
  143. {
  144. if(tickcount() - FP_LastPositionSet[playerid] > FP_TIMER_INTERVAL * 5)
  145. {
  146. if(FP_LastPosition[playerid][2])
  147. {
  148. if(!IsPlayerInAnyVehicle(playerid) && !GetPlayerInterior(playerid))
  149. {
  150. if(!IsPlayerInRangeOfPoint(playerid, 100, FP_LastPosition[playerid][0], FP_LastPosition[playerid][1], FP_LastPosition[playerid][2]))
  151. {
  152. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_TELEPORT_HACK);
  153. }
  154. }
  155. }
  156. }
  157. }
  158. #endif
  159.  
  160. if(playersPosition[0] != FP_LastPosition[playerid][0] || playersPosition[1] != FP_LastPosition[playerid][1] || playersPosition[2] != FP_LastPosition[playerid][2])
  161. {
  162. FP_LastPosition[playerid][0] = playersPosition[0], FP_LastPosition[playerid][1] = playersPosition[1], FP_LastPosition[playerid][2] = playersPosition[2];
  163. FP_LastUpdate[playerid] = tickcount();
  164. }
  165.  
  166. FP_TabbedUpdates[playerid]++;
  167.  
  168. #if defined FP_HIGH_PING
  169. if(GetPlayerPing(playerid) >= FP_MAX_PING)
  170. {
  171. FP_PingWarnings[playerid]++;
  172.  
  173. if(FP_PingWarnings[playerid] >= 3)
  174. {
  175. FP_PingWarnings[playerid] = 0;
  176. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_HIGH_PING);
  177. }
  178. }
  179. #endif
  180.  
  181. #if defined FP_VEHICLE_SPEED_HACK
  182. new playersVehicle = GetPlayerVehicleID(playerid);
  183.  
  184. if(playersVehicle)
  185. {
  186. new playersSpeed = FP_GetVehicleSpeed(playersVehicle), vehicleModel = GetVehicleModel(playersVehicle);
  187.  
  188. if((playersSpeed >= 550 && vehicleModel != 520) || (playersSpeed >= 200 && vehicleModel != 448 && vehicleModel != 461 && vehicleModel != 462 && vehicleModel != 463 && vehicleModel != 468 && vehicleModel != 521 && vehicleModel != 522 && vehicleModel != 523 && vehicleModel != 581 && vehicleModel != 586))
  189. {
  190. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_VEHICLE_SPEED_HACK);
  191. }
  192. }
  193. #endif
  194.  
  195. #if defined FP_JETPACK_HACK
  196. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  197. {
  198. if(!FP_PlayerJetpack[playerid])
  199. {
  200. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_JETPACK_HACK);
  201. }
  202. }
  203. else
  204. {
  205. FP_PlayerJetpack[playerid] = false;
  206. }
  207. #endif
  208.  
  209. #if defined FP_FLY_HACK
  210. new animationIndex = GetPlayerAnimationIndex(playerid);
  211.  
  212. if(animationIndex >= 1538 && animationIndex <= 1544 && animationIndex != 1542 && !GetPlayerInterior(playerid))
  213. {
  214. if(playersPosition[2] >= FP_GetHighestWaterLevel(playerid))
  215. {
  216. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_FLY_HACK);
  217. }
  218. }
  219. #endif
  220.  
  221. #if defined FP_AFK
  222. if(tickcount() - FP_LastUpdate[playerid] >= 300000)
  223. {
  224. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_AFK);
  225. }
  226. #endif
  227.  
  228. #if defined FP_TABBING
  229. if(FP_TabbedUpdates[playerid] >= 3)
  230. {
  231. if(playersState == PLAYER_STATE_ONFOOT || playersState == PLAYER_STATE_DRIVER || playersState == PLAYER_STATE_PASSENGER || playersState == PLAYER_STATE_SPAWNED)
  232. {
  233. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_TABBING);
  234. }
  235. }
  236. #endif
  237. }
  238.  
  239. return 1;
  240. }
  241.  
  242. public FP_ReduceChatCounter(playerid)
  243. {
  244. FP_ChatCounter[playerid]--;
  245. return 1;
  246. }
  247.  
  248. public FP_VehicleJackCheck(playerid)
  249. {
  250. FP_VehicleJacker[playerid] = INVALID_PLAYER_ID;
  251. return 1;
  252. }
  253.  
  254. public OnPlayerConnect(playerid)
  255. {
  256. for(new weaponIndex; weaponIndex < 13; weaponIndex++)
  257. {
  258. FP_PlayerWeapons[playerid][weaponIndex] = 0;
  259. }
  260.  
  261. FP_PingWarnings[playerid] = 0;
  262.  
  263. FP_PlayerJetpack[playerid] = false;
  264.  
  265. FP_ChatCounter[playerid] = 0;
  266.  
  267. FP_LastUpdate[playerid] = tickcount();
  268.  
  269. FP_TabbedUpdates[playerid] = 0;
  270.  
  271. FP_VehicleJacker[playerid] = INVALID_PLAYER_ID;
  272. FP_VehicleJackTimer[playerid] = -1;
  273.  
  274. FP_LastPositionSet[playerid] = tickcount();
  275.  
  276. FP_PlayerDetectionTimer[playerid] = SetTimerEx("FP_Detection", FP_TIMER_INTERVAL, true, "d", playerid);
  277. return (funcidx("FP_OnPlayerConnect") == -1) ? 1 : CallLocalFunction("FP_OnPlayerConnect", "d", playerid);
  278. }
  279.  
  280. #if defined _ALS_OnPlayerConnect
  281. #undef OnPlayerConnect
  282. #else
  283. #define _ALS_OnPlayerConnect
  284. #endif
  285.  
  286. #define OnPlayerConnect FP_OnPlayerConnect
  287.  
  288. public OnPlayerDisconnect(playerid, reason)
  289. {
  290. KillTimer(FP_PlayerDetectionTimer[playerid]);
  291.  
  292. if(FP_VehicleJackTimer[playerid] != -1)
  293. {
  294. KillTimer(FP_VehicleJackTimer[playerid]);
  295. }
  296.  
  297. return (funcidx("FP_OnPlayerDisconnect") == -1) ? 1 : CallLocalFunction("FP_OnPlayerDisconnect", "dd", playerid, reason);
  298. }
  299.  
  300. #if defined _ALS_OnPlayerDisconnect
  301. #undef OnPlayerDisconnect
  302. #else
  303. #define _ALS_OnPlayerDisconnect
  304. #endif
  305.  
  306. #define OnPlayerDisconnect FP_OnPlayerDisconnect
  307.  
  308. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  309. {
  310. if(!FP_Immune[playerid])
  311. {
  312. #if defined FP_WEAPON_HACK
  313. if(newkeys & KEY_FIRE && !IsPlayerInAnyVehicle(playerid))
  314. {
  315. new playersWeapon = GetPlayerWeapon(playerid);
  316.  
  317. if(playersWeapon && playersWeapon != 40 && playersWeapon != 46)
  318. {
  319. if(FP_PlayerWeapons[playerid][FP_WeaponSlots[playersWeapon]] != playersWeapon)
  320. {
  321. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_WEAPON_HACK);
  322. }
  323. }
  324. }
  325. #endif
  326. }
  327.  
  328. return (funcidx("FP_OnPlayerKeyStateChange") == -1) ? 1 : CallLocalFunction("FP_OnPlayerKeyStateChange", "ddd", playerid, newkeys, oldkeys);
  329. }
  330.  
  331. #if defined _ALS_OnPlayerKeyStateChange
  332. #undef OnPlayerKeyStateChange
  333. #else
  334. #define _ALS_OnPlayerKeyStateChange
  335. #endif
  336.  
  337. #define OnPlayerKeyStateChange FP_OnPlayerKeyStateChange
  338.  
  339. public OnPlayerDeath(playerid, killerid, reason)
  340. {
  341. FP_PlayerJetpack[playerid] = false;
  342.  
  343. if(!FP_Immune[playerid])
  344. {
  345. #if defined FP_NINJA_JACK
  346. if(FP_VehicleJacker[playerid] != INVALID_PLAYER_ID)
  347. {
  348. CallLocalFunction("OnPlayerUnfairPlay", "dd", FP_VehicleJacker[playerid], FP_NINJA_JACK);
  349. }
  350. #endif
  351.  
  352. #if defined FP_FAKE_KILL
  353. if(killerid != INVALID_PLAYER_ID)
  354. {
  355. new Float: playersHealth;
  356. GetPlayerHealth(playerid, playersHealth);
  357.  
  358. if(playersHealth)
  359. {
  360. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_FAKE_KILL);
  361. }
  362. }
  363. #endif
  364. }
  365.  
  366. FP_LastPositionSet[playerid] = tickcount();
  367. return (funcidx("FP_OnPlayerDeath") == -1) ? 1 : CallLocalFunction("FP_OnPlayerDeath", "ddd", playerid, killerid, reason);
  368. }
  369.  
  370. #if defined _ALS_OnPlayerDeath
  371. #undef OnPlayerDeath
  372. #else
  373. #define _ALS_OnPlayerDeath
  374. #endif
  375.  
  376. #define OnPlayerDeath FP_OnPlayerDeath
  377.  
  378. public OnPlayerSpawn(playerid)
  379. {
  380. FP_PlayerJetpack[playerid] = false;
  381. FP_LastPositionSet[playerid] = tickcount();
  382. return (funcidx("FP_OnPlayerSpawn") == -1) ? 1 : CallLocalFunction("FP_OnPlayerSpawn", "d", playerid);
  383. }
  384.  
  385. #if defined _ALS_OnPlayerSpawn
  386. #undef OnPlayerSpawn
  387. #else
  388. #define _ALS_OnPlayerSpawn
  389. #endif
  390.  
  391. #define OnPlayerSpawn FP_OnPlayerSpawn
  392.  
  393. public OnPlayerStateChange(playerid, newstate, oldstate)
  394. {
  395. if(!FP_Immune[playerid])
  396. {
  397. #if defined FP_DRIVER_DRIVEBY
  398. if(newstate == PLAYER_STATE_DRIVER)
  399. {
  400. SetPlayerArmedWeapon(playerid, 0);
  401. }
  402. #endif
  403.  
  404. #if defined FP_DRIVEBY_WEAPONS_RESTRICT
  405. if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  406. {
  407. new playersWeapon = GetPlayerWeapon(playerid), allowedWeapons[15], bool: playerValidWeapon;
  408. sscanf(FP_DRIVEBY_WEAPONS, "a<i>[15]", allowedWeapons);
  409.  
  410. for(new weaponIndex; weaponIndex < sizeof(allowedWeapons); weaponIndex++)
  411. {
  412. if((allowedWeapons[weaponIndex] && playersWeapon == allowedWeapons[weaponIndex]) || !playersWeapon)
  413. {
  414. playerValidWeapon = true;
  415. break;
  416. }
  417. }
  418.  
  419. if(!playerValidWeapon)
  420. {
  421. SetPlayerArmedWeapon(playerid, 0);
  422. }
  423. }
  424. #endif
  425.  
  426. #if defined FP_NINJA_JACK
  427. if(newstate == PLAYER_STATE_DRIVER)
  428. {
  429. for(new playerIndex; playerIndex < MAX_PLAYERS; playerIndex++)
  430. {
  431. if(FP_VehicleJacker[playerIndex] == playerid)
  432. {
  433. SetTimerEx("FP_VehicleJackCheck", 1000, 0, "i", playerIndex);
  434.  
  435. KillTimer(FP_VehicleJackTimer[playerIndex]);
  436. FP_VehicleJackTimer[playerIndex] = -1;
  437. break;
  438. }
  439. }
  440. }
  441. #endif
  442. }
  443.  
  444. return (funcidx("FP_OnPlayerStateChange") == -1) ? 1 : CallLocalFunction("FP_OnPlayerStateChange", "ddd", playerid, newstate, oldstate);
  445. }
  446.  
  447. #if defined _ALS_OnPlayerStateChange
  448. #undef OnPlayerStateChange
  449. #else
  450. #define _ALS_OnPlayerStateChange
  451. #endif
  452.  
  453. #define OnPlayerStateChange FP_OnPlayerStateChange
  454.  
  455. public OnPlayerText(playerid, text[])
  456. {
  457. if(!FP_Immune[playerid])
  458. {
  459. #if defined FP_SWEARING
  460. new wordLocation, bool: playerSwearing;
  461.  
  462. for(new wordIndex; wordIndex < sizeof(FP_CurseWords); wordIndex++)
  463. {
  464. wordLocation = strfind(text, FP_CurseWords[wordIndex], true);
  465.  
  466. while(wordLocation > -1)
  467. {
  468. playerSwearing = true;
  469.  
  470. for(new textIndex = wordLocation; textIndex < wordLocation + strlen(FP_CurseWords[wordIndex]); textIndex++)
  471. {
  472. text[textIndex] = '*';
  473. }
  474.  
  475. wordLocation = strfind(text, FP_CurseWords[wordIndex], true, wordLocation);
  476. }
  477. }
  478.  
  479. if(playerSwearing)
  480. {
  481. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_SWEARING);
  482. }
  483. #endif
  484.  
  485. #if defined FP_CHAT_SPAM
  486. FP_ChatCounter[playerid]++;
  487.  
  488. if(FP_ChatCounter[playerid] >= 4)
  489. {
  490. FP_ChatCounter[playerid] = 0;
  491. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_CHAT_SPAM);
  492. }
  493. else
  494. {
  495. SetTimerEx("FP_ReduceChatCounter", 850, 0, "d", playerid);
  496. }
  497. #endif
  498.  
  499. #if defined FP_SERVER_AD
  500. new dotCount, colonCount, portCount;
  501.  
  502. for(new stringIndex, stringLength = strlen(text); stringIndex < stringLength; stringIndex++)
  503. {
  504. if(text[stringIndex] == '.')
  505. {
  506. dotCount++;
  507. }
  508. else if(text[stringIndex] == ':')
  509. {
  510. colonCount++;
  511. }
  512. else if(stringIndex + 3 < stringLength)
  513. {
  514. if('0' <= text[stringIndex] <= '9' && '0' <= text[stringIndex + 1] <= '9' && '0' <= text[stringIndex + 2] <= '9' && '0' <= text[stringIndex + 3] <= '9')
  515. {
  516. portCount++;
  517. }
  518. }
  519. }
  520.  
  521. if(dotCount >= 2 && (colonCount || portCount) && strfind(text, FP_SERVER_IP) == -1 && strfind(text, FP_SERVER_DOMAIN, true) == -1)
  522. {
  523. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_SERVER_AD);
  524. }
  525. #endif
  526. }
  527.  
  528. FP_LastUpdate[playerid] = tickcount();
  529. return (funcidx("FP_OnPlayerText") == -1) ? 1 : CallLocalFunction("FP_OnPlayerText", "ds", playerid, text);
  530. }
  531.  
  532. #if defined _ALS_OnPlayerText
  533. #undef OnPlayerText
  534. #else
  535. #define _ALS_OnPlayerText
  536. #endif
  537.  
  538. #define OnPlayerText FP_OnPlayerText
  539.  
  540. public OnPlayerCommandText(playerid, cmdtext[])
  541. {
  542. if(!FP_Immune[playerid])
  543. {
  544. #if defined FP_SWEARING
  545. new wordLocation, bool: playerSwearing;
  546.  
  547. for(new wordIndex; wordIndex < sizeof(FP_CurseWords); wordIndex++)
  548. {
  549. wordLocation = strfind(cmdtext, FP_CurseWords[wordIndex], true);
  550.  
  551. while(wordLocation > -1)
  552. {
  553. playerSwearing = true;
  554.  
  555. for(new textIndex = wordLocation; textIndex < wordLocation + strlen(FP_CurseWords[wordIndex]); textIndex++)
  556. {
  557. cmdtext[textIndex] = '*';
  558. }
  559.  
  560. wordLocation = strfind(cmdtext, FP_CurseWords[wordIndex], true, wordLocation);
  561. }
  562. }
  563.  
  564. if(playerSwearing)
  565. {
  566. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_SWEARING);
  567. }
  568. #endif
  569.  
  570. #if defined FP_CHAT_SPAM
  571. FP_ChatCounter[playerid]++;
  572.  
  573. if(FP_ChatCounter[playerid] >= 4)
  574. {
  575. FP_ChatCounter[playerid] = 0;
  576. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_CHAT_SPAM);
  577. }
  578. else
  579. {
  580. SetTimerEx("FP_ReduceChatCounter", 850, 0, "d", playerid);
  581. }
  582. #endif
  583.  
  584. #if defined FP_SERVER_AD
  585. new dotCount, colonCount, portCount;
  586.  
  587. for(new stringIndex, stringLength = strlen(cmdtext); stringIndex < stringLength; stringIndex++)
  588. {
  589. if(cmdtext[stringIndex] == '.')
  590. {
  591. dotCount++;
  592. }
  593. else if(cmdtext[stringIndex] == ':')
  594. {
  595. colonCount++;
  596. }
  597. else if(stringIndex + 3 < stringLength)
  598. {
  599. if('0' <= cmdtext[stringIndex] <= '9' && '0' <= cmdtext[stringIndex + 1] <= '9' && '0' <= cmdtext[stringIndex + 2] <= '9' && '0' <= cmdtext[stringIndex + 3] <= '9')
  600. {
  601. portCount++;
  602. }
  603. }
  604. }
  605.  
  606. if(dotCount >= 2 && (colonCount || portCount) && strfind(cmdtext, FP_SERVER_IP) == -1 && strfind(cmdtext, FP_SERVER_DOMAIN, true) == -1)
  607. {
  608. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_SERVER_AD);
  609. }
  610. #endif
  611. }
  612.  
  613. FP_LastUpdate[playerid] = tickcount();
  614. return (funcidx("FP_OnPlayerCommandText") == -1) ? 1 : CallLocalFunction("FP_OnPlayerCommandText", "ds", playerid, cmdtext);
  615. }
  616.  
  617. #if defined _ALS_OnPlayerCommandText
  618. #undef OnPlayerCommandText
  619. #else
  620. #define _ALS_OnPlayerCommandText
  621. #endif
  622.  
  623. #define OnPlayerCommandText FP_OnPlayerCommandText
  624.  
  625. public OnPlayerUpdate(playerid)
  626. {
  627. FP_TabbedUpdates[playerid] = 0;
  628. return (funcidx("FP_OnPlayerUpdate") == -1) ? 1 : CallLocalFunction("FP_OnPlayerUpdate", "d", playerid);
  629. }
  630.  
  631. #if defined _ALS_OnPlayerUpdate
  632. #undef OnPlayerUpdate
  633. #else
  634. #define _ALS_OnPlayerUpdate
  635. #endif
  636.  
  637. #define OnPlayerUpdate FP_OnPlayerUpdate
  638.  
  639. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  640. {
  641. if(!FP_Immune[playerid])
  642. {
  643. #if defined FP_CAR_RAM
  644. if(weaponid == 49)
  645. {
  646. CallLocalFunction("OnPlayerUnfairPlay", "dd", issuerid, FP_CAR_RAM);
  647. }
  648. #endif
  649.  
  650. #if defined FP_HELIBLADE
  651. if(weaponid == 50)
  652. {
  653. CallLocalFunction("OnPlayerUnfairPlay", "dd", issuerid, FP_HELIBLADE);
  654. }
  655. #endif
  656. }
  657.  
  658. return (funcidx("FP_OnPlayerTakeDamage") == -1) ? 1 : CallLocalFunction("FP_OnPlayerTakeDamage", "ddfd", playerid, issuerid, amount, weaponid);
  659. }
  660.  
  661. #if defined _ALS_OnPlayerTakeDamage
  662. #undef OnPlayerTakeDamage
  663. #else
  664. #define _ALS_OnPlayerTakeDamage
  665. #endif
  666.  
  667. #define OnPlayerTakeDamage FP_OnPlayerTakeDamage
  668.  
  669. public OnVehicleMod(playerid, vehicleid, componentid)
  670. {
  671. if(!FP_Immune[playerid])
  672. {
  673. #if defined FP_VEHICLE_MOD_HACK
  674. if(!GetPlayerInterior(playerid))
  675. {
  676. CallLocalFunction("OnPlayerUnfairPlay", "dd", playerid, FP_VEHICLE_MOD_HACK);
  677. return 0;
  678. }
  679. #endif
  680. }
  681.  
  682. return (funcidx("FP_OnVehicleMod") == -1) ? 1 : CallLocalFunction("FP_OnVehicleMod", "ddd", playerid, vehicleid, componentid);
  683. }
  684.  
  685. #if defined _ALS_OnVehicleMod
  686. #undef OnVehicleMod
  687. #else
  688. #define _ALS_OnVehicleMod
  689. #endif
  690.  
  691. #define OnVehicleMod FP_OnVehicleMod
  692.  
  693. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  694. {
  695. if(!FP_Immune[playerid])
  696. {
  697. #if defined FP_NINJA_JACK
  698. if(!ispassenger)
  699. {
  700. for(new playerIndex; playerIndex < MAX_PLAYERS; playerIndex++)
  701. {
  702. if(IsPlayerInVehicle(playerIndex, vehicleid) && !GetPlayerVehicleSeat(playerIndex))
  703. {
  704. FP_VehicleJacker[playerIndex] = playerid;
  705. FP_VehicleJackTimer[playerIndex] = SetTimerEx("FP_VehicleJackCheck", 10000, 0, "d", playerIndex);
  706. break;
  707. }
  708. }
  709. }
  710. #endif
  711. }
  712.  
  713. return (funcidx("FP_OnPlayerEnterVehicle") == -1) ? 1 : CallLocalFunction("FP_OnPlayerEnterVehicle", "ddd", playerid, vehicleid, ispassenger);
  714. }
  715.  
  716. #if defined _ALS_OnPlayerEnterVehicle
  717. #undef OnPlayerEnterVehicle
  718. #else
  719. #define _ALS_OnPlayerEnterVehicle
  720. #endif
  721.  
  722. #define OnPlayerEnterVehicle FP_OnPlayerEnterVehicle
  723.  
  724. stock FP_GivePlayerWeapon(playerid, weaponid, ammo)
  725. {
  726. FP_PlayerWeapons[playerid][FP_WeaponSlots[weaponid]] = weaponid;
  727. return GivePlayerWeapon(playerid, weaponid, ammo);
  728. }
  729.  
  730. #if defined _ALS_GivePlayerWeapon
  731. #undef GivePlayerWeapon
  732. #else
  733. #define _ALS_GivePlayerWeapon
  734. #endif
  735.  
  736. #define GivePlayerWeapon FP_GivePlayerWeapon
  737.  
  738. stock FP_ResetPlayerWeapons(playerid)
  739. {
  740. for(new weaponIndex; weaponIndex < 13; weaponIndex++)
  741. {
  742. FP_PlayerWeapons[playerid][weaponIndex] = 0;
  743. }
  744.  
  745. return ResetPlayerWeapons(playerid);
  746. }
  747.  
  748. #if defined _ALS_ResetPlayerWeapons
  749. #undef ResetPlayerWeapons
  750. #else
  751. #define _ALS_ResetPlayerWeapons
  752. #endif
  753.  
  754. #define ResetPlayerWeapons FP_ResetPlayerWeapons
  755.  
  756. stock FP_SetPlayerAmmo(playerid, weapon, ammo)
  757. {
  758. if(!ammo)
  759. {
  760. FP_PlayerWeapons[playerid][FP_WeaponSlots[weapon]] = 0;
  761. }
  762.  
  763. return SetPlayerAmmo(playerid, weapon, ammo);
  764. }
  765.  
  766. #if defined _ALS_SetPlayerAmmo
  767. #undef SetPlayerAmmo
  768. #else
  769. #define _ALS_SetPlayerAmmo
  770. #endif
  771.  
  772. #define SetPlayerAmmo FP_SetPlayerAmmo
  773.  
  774. stock FP_SetPlayerSpecialAction(playerid, actionid)
  775. {
  776. if(actionid == SPECIAL_ACTION_USEJETPACK)
  777. {
  778. FP_PlayerJetpack[playerid] = true;
  779. }
  780. else if(actionid == SPECIAL_ACTION_NONE)
  781. {
  782. FP_PlayerJetpack[playerid] = false;
  783. }
  784.  
  785. return SetPlayerSpecialAction(playerid, actionid);
  786. }
  787.  
  788. #if defined _ALS_SetPlayerSpecialAction
  789. #undef SetPlayerSpecialAction
  790. #else
  791. #define _ALS_SetPlayerSpecialAction
  792. #endif
  793.  
  794. #define SetPlayerSpecialAction FP_SetPlayerSpecialAction
  795.  
  796. stock FP_ClearAnimations(playerid, forcesync)
  797. {
  798. FP_PlayerJetpack[playerid] = false;
  799. return ClearAnimations(playerid, forcesync);
  800. }
  801.  
  802. #if defined _ALS_ClearAnimations
  803. #undef ClearAnimations
  804. #else
  805. #define _ALS_ClearAnimations
  806. #endif
  807.  
  808. #define ClearAnimations FP_ClearAnimations
  809.  
  810. stock FP_SetPlayerPos(playerid, Float: x, Float: y, Float: z)
  811. {
  812. FP_LastPositionSet[playerid] = tickcount();
  813. return SetPlayerPos(playerid, x, y, z);
  814. }
  815.  
  816. #if defined _ALS_SetPlayerPos
  817. #undef SetPlayerPos
  818. #else
  819. #define _ALS_SetPlayerPos
  820. #endif
  821.  
  822. #define SetPlayerPos FP_SetPlayerPos
  823.  
  824. stock FP_SetPlayerPosFindZ(playerid, Float: x, Float: y, Float: z)
  825. {
  826. FP_LastPositionSet[playerid] = tickcount();
  827. return SetPlayerPosFindZ(playerid, x, y, z);
  828. }
  829.  
  830. #if defined _ALS_SetPlayerPosFindZ
  831. #undef SetPlayerPosFindZ
  832. #else
  833. #define _ALS_SetPlayerPosFindZ
  834. #endif
  835.  
  836. #define SetPlayerPosFindZ FP_SetPlayerPosFindZ
  837.  
  838. stock FP_SetPlayerVelocity(playerid, Float: x, Float: y, Float: z)
  839. {
  840. FP_LastPositionSet[playerid] = tickcount();
  841. return SetPlayerVelocity(playerid, x, y, z);
  842. }
  843.  
  844. #if defined _ALS_SetPlayerVelocity
  845. #undef SetPlayerVelocity
  846. #else
  847. #define _ALS_SetPlayerVelocity
  848. #endif
  849.  
  850. #define SetPlayerVelocity FP_SetPlayerVelocity
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement