HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fun>
  4. #include <hamsandwich>
  5. #include <fakemeta>
  6. #include <engine>
  7.  
  8. #define VERSION "1.2.4"
  9. #define OFFSET_PRIMARYWEAPON 116
  10. #define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)
  11.  
  12. new bool: g_HasArrest[33]
  13.  
  14. new MaxCuffs[33]
  15. new g_iMaxPlayers
  16.  
  17. new handcuffs_on, max_handcuffs, distance, delay
  18.  
  19. new const ARREST[] = "jail/arrestation/menotte.wav"
  20. new const HANDCUFFS[] = "jail/arrestation/mainenlair.wav"
  21.  
  22. public plugin_init()
  23. {
  24. register_plugin("Jailbreak Arrest", VERSION, "GuiSmoO'")
  25.  
  26. RegisterHam(Ham_Spawn, "player", "Event_PlayerSpawn", 1)
  27.  
  28. register_clcmd("arrest", "commandestop")
  29. register_clcmd("drag", "commandestop")
  30. register_clcmd("stop", "commandestop")
  31. register_clcmd("say /arrest", "commandestop")
  32. register_clcmd("/stop", "commandestop")
  33.  
  34. handcuffs_on = register_cvar("jail_handcuffs_on", "1")
  35. max_handcuffs = register_cvar("jail_max_handcuffs", "1")
  36. distance = register_cvar("jail_distance_handcuffs", "150")
  37. delay = register_cvar("jail_delay_respawn", "4")
  38.  
  39. g_iMaxPlayers = get_maxplayers()
  40.  
  41. register_dictionary( "jailbreak_arrest.txt")
  42. }
  43.  
  44. public plugin_precache()
  45. {
  46. precache_sound(ARREST)
  47. precache_sound(HANDCUFFS)
  48. }
  49.  
  50. public client_putinserver(id)
  51. {
  52. g_HasArrest[id] = false
  53. }
  54.  
  55. public Event_PlayerSpawn(id)
  56. {
  57. g_HasArrest[id] = false
  58.  
  59. if(cs_get_user_team(id) == CS_TEAM_CT && get_pcvar_num(handcuffs_on))
  60. {
  61. MaxCuffs[id] = get_pcvar_num(max_handcuffs)
  62. client_print(id, print_chat,"%L", id, "RECEIVE_HANDCUFFS", MaxCuffs[id])
  63. client_print(id, print_chat,"%L", id, "HELP_USE")
  64. }
  65. return PLUGIN_CONTINUE;
  66. }
  67.  
  68. public commandestop(id)
  69. {
  70. new name[32], Username[32]
  71. new playerid, body
  72.  
  73. new Float:flDistance = get_user_aiming(id, playerid, body)
  74.  
  75. get_user_name(id,name, charsmax(name))
  76. get_user_name(playerid,Username, charsmax(Username))
  77.  
  78. if(!get_pcvar_num(handcuffs_on))
  79. return PLUGIN_HANDLED;
  80.  
  81. if(is_user_alive(id) && is_user_alive(playerid) && IsPlayer(playerid) && cs_get_user_team(id) == CS_TEAM_CT
  82. && cs_get_user_team(playerid) == CS_TEAM_T && MaxCuffs[id] > 0 && flDistance <= get_pcvar_float(distance))
  83. {
  84. MaxCuffs[id]--
  85. client_cmd(id, "spk %s", ARREST)
  86.  
  87. player_arrest(playerid)
  88. client_print(id, print_chat,"%L", id, "ARRESTS", name, Username)
  89. client_print(playerid, print_chat,"%L", playerid, "ARRESTED", name)
  90. }
  91. else if(MaxCuffs[id] == 0)
  92. {
  93. client_print(id, print_chat,"%L", id, "MAX_HANDCUFFS")
  94. return PLUGIN_HANDLED;
  95. }
  96. else if(flDistance > get_pcvar_float(distance))
  97. {
  98. client_print(id, print_chat,"%L", id, "PRISONNER_FAR")
  99. return PLUGIN_HANDLED;
  100. }
  101. return PLUGIN_CONTINUE;
  102. }
  103.  
  104. public prison(playerid)
  105. {
  106. if(g_HasArrest[playerid] == true)
  107. {
  108. reset_arrest(playerid)
  109. }
  110. }
  111.  
  112. player_arrest(index)
  113. {
  114. client_cmd(index, "spk %s", ARREST)
  115. set_entity_flags(index, FL_FROZEN, 1)
  116. set_user_godmode(index, 1)
  117. strip_user_weapons(index)
  118. set_pdata_int(index, OFFSET_PRIMARYWEAPON, 0)
  119. g_HasArrest[index] = true
  120. set_task(get_pcvar_float(delay), "prison", index)
  121. }
  122.  
  123. reset_arrest(index)
  124. {
  125. ExecuteHamB(Ham_CS_RoundRespawn, index)
  126. strip_user_weapons(index)
  127. set_pdata_int(index, OFFSET_PRIMARYWEAPON, 0)
  128. give_item(index, "weapon_knife")
  129. set_entity_flags(index, FL_FROZEN, 0)
  130. set_user_godmode(index, 0)
  131. g_HasArrest[index] = false
  132. }
  133.