HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine_stocks>
  4. #include <hamsandwich>
  5.  
  6. #define PLUGIN "AirSpeedLimit"
  7. #define VERSION "1.0"
  8. #define AUTHOR "Kova"
  9.  
  10. #define SPEEDLIMIT 600.0
  11.  
  12. new Float:NewVelocity[33][3];
  13. new Float:VerticalVelocity[33];
  14. new Float:speed[33];
  15. new g_Alive[33];
  16. new g_MaxPlayer;
  17.  
  18. public plugin_init() {
  19. register_plugin(PLUGIN, VERSION, AUTHOR)
  20.  
  21. set_task(0.1, "Check",_,_,_,"b");
  22. RegisterHam(Ham_Spawn, "player", "hamPlayerSpawn", 1);
  23. register_event("DeathMsg", "eventPlayerDeath", "a");
  24.  
  25. g_MaxPlayer = get_maxplayers();
  26. }
  27.  
  28. public Check()
  29. {
  30. for(new i = 0; i < g_MaxPlayer; i++)
  31. {
  32. if(!g_Alive[i])
  33. continue;
  34.  
  35. SpeedTester(i);
  36. }
  37. }
  38.  
  39. public hamPlayerSpawn(id)
  40. {
  41. if(!is_user_alive(id))
  42. return;
  43.  
  44. g_Alive[id] = true;
  45. }
  46.  
  47. public eventPlayerDeath()
  48. {
  49. g_Alive[read_data(2)] = false;
  50. }
  51.  
  52. public client_disconnected(id)
  53. {
  54. g_Alive[id] = false;
  55. }
  56.  
  57. public SpeedTester(id)
  58. {
  59. get_user_velocity(id, NewVelocity[id]);
  60. VerticalVelocity[id] = NewVelocity[id][2];
  61. NewVelocity[id][2] = 0.0;
  62. speed[id] = vector_length(NewVelocity[id]);
  63. if(speed[id] > SPEEDLIMIT)
  64. {
  65. client_print(id, print_center, "Túl gyorsan mész! | Sebességed: %.2f", speed[id]);
  66. NewVelocity[id][0] = NewVelocity[id][0] * (SPEEDLIMIT / speed[id]);
  67. NewVelocity[id][1] = NewVelocity[id][1] * (SPEEDLIMIT / speed[id]);
  68. NewVelocity[id][2] = VerticalVelocity[id];
  69. set_user_velocity(id, NewVelocity[id]);
  70. }
  71. }
  72.  
  73. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  74. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  75. */
  76.