HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. * _______ _ _ __ __
  3. * | _____/ | | | | \ \ __ / /
  4. * | | | | | | | | / \ | |
  5. * | | | |____| | | |/ __ \| |
  6. * | | ___ | ______ | | / \ |
  7. * | | |_ | | | | | | / \ |
  8. * | | | | | | | | | | | |
  9. * | |____| | | | | | | | | |
  10. * |_______/ |_| |_| \_/ \_/
  11. *
  12. *
  13. *
  14. * Last Edited: 12-31-07
  15. *
  16. * ============
  17. * Changelog:
  18. * ============
  19. *
  20. * v2.0
  21. * -Added ML
  22. * -Optimized Code
  23. *
  24. * v1.0
  25. * -Initial Release
  26. *
  27. */
  28.  
  29. #define VERSION "2.0"
  30.  
  31. #include <amxmodx>
  32. #include <amxmisc>
  33. #include <fun>
  34. #include <cstrike>
  35.  
  36. new bool:has_rb[33]
  37. new cost_cvar, lasts_cvar, speed_cvar
  38.  
  39. public plugin_init()
  40. {
  41. register_plugin("Red Bull",VERSION,"GHW_Chronic")
  42.  
  43. register_clcmd("say /RedBull","say_cmd_handle")
  44.  
  45. cost_cvar = register_cvar("RB_Cost","2000")
  46. lasts_cvar = register_cvar("RB_Lasts","20.0")
  47. speed_cvar = register_cvar("RB_Speed","650.0")
  48.  
  49. register_event("CurWeapon","curweap","be")
  50.  
  51. register_dictionary("GHW_Red_Bull.txt")
  52. }
  53.  
  54. public curweap(id)
  55. {
  56. if(is_user_alive(id) && has_rb[id])
  57. {
  58. client_cmd(id,"cl_forwardspeed 400;cl_backspeed 400;cl_sidespeed 400")
  59. set_user_maxspeed(id,get_pcvar_float(speed_cvar))
  60. }
  61. }
  62.  
  63. public client_connect(id) has_rb[id]=false
  64. public client_disconnect(id) has_rb[id]=false
  65.  
  66. public say_cmd_handle(id)
  67. {
  68. if(!is_user_alive(id))
  69. {
  70. client_print(id,print_chat,"[RB] %L",id,"MSG_NOBUY_DEAD")
  71. }
  72. else if(has_rb[id])
  73. {
  74. client_print(id,print_chat,"[RB] %L",id,"MSG_NOBUY_HAVE")
  75. }
  76. else if(cs_get_user_money(id)<get_pcvar_num(cost_cvar))
  77. {
  78. client_print(id,print_chat,"[RB] %L",id,"MSG_NOBUY_POOR",get_pcvar_num(cost_cvar))
  79. }
  80. else
  81. {
  82. cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(cost_cvar),1)
  83. has_rb[id]=true
  84. set_task(get_pcvar_float(lasts_cvar),"redbull_over",id)
  85. set_task(1.0,"plus_hp",id,"",0,"b")
  86. set_user_gravity(id,0.5)
  87. set_user_maxspeed(id,get_pcvar_float(speed_cvar))
  88. client_print(id,print_chat,"[RB] %L",id,"MSG_REDBULL1")
  89. client_print(id,print_chat,"[RB] %L",id,"MSG_REDBULL2")
  90. }
  91. }
  92.  
  93. public plus_hp(id)
  94. {
  95. if(has_rb[id]) set_user_health(id,get_user_health(id)+1)
  96. }
  97.  
  98. public redbull_over(id)
  99. {
  100. if(is_user_connected(id))
  101. {
  102. has_rb[id]=false
  103. client_print(id,print_chat,"[RB] %L",id,"MSG_REDBULL_OFF")
  104. set_user_gravity(id,1.0)
  105. set_user_maxspeed(id,320.0)
  106. set_user_gravity(id,1.0)
  107. remove_task(id)
  108. }
  109. }
  110.