Advertisement
Guest User

Fast Respawn Anti-Cheat v1.3

a guest
Jun 8th, 2017
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.79 KB | None | 0 0
  1. /*
  2.             Anti-Cheat: Fast Spawn
  3.             Author: Twixxx a.k.a Twixyck
  4.             Date of publication: 05.06.2017
  5.  
  6.             Current version: 1.3
  7.  
  8.             Contacts:
  9.             VK: vk.com/twixmakkord
  10.             Skype: n.shtimenklo
  11. */
  12. #define DEFAULT_SPAWN_TIME 3000
  13.  
  14. static
  15.     player_spawn_time[MAX_PLAYERS],
  16.     already_spawned_time[MAX_PLAYERS],
  17.     player_call_spawn_count[MAX_PLAYERS];
  18.  
  19. public OnPlayerDeath(playerid, killerid, reason)
  20. {
  21.     player_spawn_time[playerid] = GetTickCount();
  22.  
  23.     #if defined ac_fastspawn__OnPlayerDeath
  24.         ac_fastspawn__OnPlayerDeath(playerid, killerid, reason);
  25.     #endif
  26.     return 1;
  27. }
  28. #if defined _ALS_OnPlayerDeath
  29.     #undef OnPlayerDeath
  30. #else
  31.     #define _ALS_OnPlayerDeath
  32. #endif
  33. #define OnPlayerDeath ac_fastspawn__OnPlayerDeath
  34. #if defined ac_fastspawn__OnPlayerDeath
  35. forward ac_fastspawn__OnPlayerDeath(playerid, killerid, reason);
  36. #endif
  37.  
  38. #if defined OnFastRespawnCheatDetected
  39. forward OnFastRespawnCheatDetected(playerid);
  40. #endif  
  41.  
  42. public OnPlayerSpawn(playerid)
  43. {
  44.     player_call_spawn_count[playerid]++;
  45.     already_spawned_time[playerid] = GetTickCount() - player_spawn_time[playerid];
  46.  
  47.     if(already_spawned_time[playerid] < DEFAULT_SPAWN_TIME)
  48.     {
  49.         if(player_call_spawn_count[playerid] == 2)
  50.         {
  51.             CallLocalFunction("OnFastRespawnCheatDetected", "dd", playerid, already_spawned_time[playerid]);
  52.         }
  53.         else return 1;
  54.     }
  55.     else
  56.     {
  57.         player_spawn_time[playerid] = 0;
  58.         already_spawned_time[playerid] = 0;
  59.         player_call_spawn_count[playerid] = 0;
  60.     }
  61.     #if defined ac_fastspawn__OnPlayerSpawn
  62.         ac_fastspawn__OnPlayerSpawn(playerid);
  63.     #endif
  64.     return 1;
  65. }
  66. #if defined _ALS_OnPlayerSpawn
  67.     #undef OnPlayerSpawn
  68. #else
  69.     #define _ALS_OnPlayerSpawn
  70. #endif
  71. #define OnPlayerSpawn ac_fastspawn__OnPlayerSpawn
  72. #if defined ac_fastspawn__OnPlayerSpawn
  73. forward ac_fastspawn__OnPlayerSpawn(playerid);
  74. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement