HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*******************************************************************************************************
  2.   AMX CSS Zoom
  3.  
  4.  
  5.   Author: KRoTaL
  6.   Version: 0.2
  7.  
  8.   0.1 Release
  9.   0.2 Fixed the crossair with aug/sg552
  10.  
  11.  
  12.   Zoom effect of CS-Source.
  13.  
  14.  
  15.   Cvar:
  16.  
  17.   css_zoom 0/1 - 0: disables the plugin
  18.   1: enables the plugin
  19.  
  20.  
  21.   Setup (AMX 0.9.9):
  22.  
  23.   Install the amx file.
  24.   Enable VexdUM (both in metamod/plugins.ini and amx/config/modules.ini)
  25.  
  26.   Setup (AMXX 1.1):
  27.  
  28.   Install the amxx file.
  29.  
  30. *******************************************************************************************************/
  31.  
  32. #include <amxmodx>
  33. #include <amxmisc>
  34.  
  35. new gmsgSetFOV
  36. new g_lastFov[33]
  37. new g_MinMaxFov[33][2]
  38. new g_doFov[33]
  39.  
  40. public plugin_init()
  41. {
  42. register_plugin("CSS Zoom", "0.2", "KRoTaL")
  43. register_cvar("css_zoom", "1")
  44. register_event("SetFOV", "eventSetFOV", "be")
  45. gmsgSetFOV = get_user_msgid("SetFOV")
  46. }
  47.  
  48. public client_connect(id)
  49. {
  50. g_doFov[id] = 0
  51. }
  52.  
  53. public eventSetFOV(id)
  54. {
  55. new fov = read_data(1)
  56. if(fov < g_lastFov[id])
  57. {
  58. g_MinMaxFov[id][0] = fov
  59. g_MinMaxFov[id][1] = g_lastFov[id]
  60. g_doFov[id] = 1
  61. }
  62. else
  63. {
  64. g_doFov[id] = 0
  65. }
  66. g_lastFov[id] = fov
  67. }
  68.  
  69. public client_PreThink(id)
  70. {
  71. if(get_cvar_num("css_zoom") == 0)
  72. return PLUGIN_CONTINUE
  73.  
  74. if(g_doFov[id])
  75. {
  76. if(g_MinMaxFov[id][1] > g_MinMaxFov[id][0])
  77. {
  78. --g_MinMaxFov[id][1]
  79. message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)
  80. write_byte(--g_MinMaxFov[id][1])
  81. message_end()
  82. }
  83. else
  84. {
  85. message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)
  86. write_byte(g_MinMaxFov[id][0])
  87. message_end()
  88. g_doFov[id] = 0
  89. }
  90. }
  91. return PLUGIN_CONTINUE
  92. }
  93.