HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <cstrike>
  3.  
  4. #define PLUGIN_VERSION "1.2.4"
  5.  
  6. // Variable
  7. new zoom_cost
  8.  
  9. public plugin_init()
  10. {
  11. // Register Plugin
  12. register_plugin( "Buy Zoom", PLUGIN_VERSION, "fezh" )
  13.  
  14. // Client Commands
  15. register_clcmd( "say /zoom", "set_zoom" )
  16. register_clcmd( "say_team /zoom", "set_zoom" )
  17. register_clcmd( "say /remove", "remove_zoom" )
  18. register_clcmd( "say_team /remove", "remove_zoom" )
  19. register_clcmd( "say /zoomhelp", "cmd_helpmotd" )
  20. register_clcmd( "say_team /zoomhelp", "cmd_helpmotd" )
  21.  
  22. // CVAR
  23. zoom_cost = register_cvar( "amxx_zoom_cost", "500" )
  24.  
  25. // Plugin Version
  26. register_cvar( "buy_zoom_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
  27.  
  28. // Multilingual Dictionary
  29. register_dictionary( "buy_zoom.txt")
  30.  
  31. // Bug Fix
  32. register_event( "DeathMsg", "user_dead", "a" )
  33. }
  34.  
  35. // Plugin Message
  36. public client_putinserver( id )
  37. {
  38. set_task( 15.0, "plugin_message", id )
  39. }
  40.  
  41. // Plugin Shows Help Message
  42. public plugin_message( id )
  43. {
  44. client_print( 0, print_chat, "%L", LANG_PLAYER, "HELPMSG" )
  45. }
  46.  
  47. // Bug fix
  48. public user_dead()
  49. {
  50. new id = read_data( 2 )
  51. cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
  52.  
  53. return PLUGIN_HANDLED
  54. }
  55.  
  56. // Remove Command
  57. public remove_zoom( id )
  58. {
  59. cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
  60. client_print( id, print_chat, "%L", id, "REMMSG" )
  61.  
  62. return PLUGIN_HANDLED
  63. }
  64.  
  65. // Buy Command
  66. public set_zoom( id )
  67. {
  68. new money_left_over = cs_get_user_money( id ) - get_pcvar_num( zoom_cost );
  69. if ( money_left_over < 0 )
  70. {
  71. client_print( id, print_chat, "%L", id, "DONTZOOM" )
  72.  
  73. return PLUGIN_HANDLED
  74. }
  75.  
  76. cs_set_user_money( id, money_left_over, 1 )
  77. cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
  78. client_print( id, print_chat, "%L", id, "ZOOMMSG" )
  79.  
  80. return PLUGIN_HANDLED
  81. }
  82.  
  83. // Help Motd
  84. public cmd_helpmotd( id )
  85. {
  86. static motd[ 2048 ]
  87. formatex( motd, 2047,"%L", id, "HELP_MOTD" )
  88.  
  89. show_motd( id, motd, "Zoom Commands" )
  90. }