HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <cstrike>
  3.  
  4. #define PLUGIN "Buy Flashlight"
  5. #define VERSION "1.0"
  6. #define AUTHOR "Styles"
  7.  
  8.  
  9. new p_FlashlightCost
  10. new bool:hasLight[32]
  11.  
  12. public plugin_init()
  13. {
  14. register_plugin(PLUGIN, VERSION, AUTHOR)
  15.  
  16. /* Commands */
  17. register_clcmd("say /buyflashlight", "buyLight")
  18. register_clcmd("say /buylight", "buyLight")
  19.  
  20. /* Cvars */
  21. p_FlashlightCost = register_cvar("mp_flashlightCost", "500")
  22.  
  23. /* Events */
  24. register_event("HLTV", "playerSpawn", "be")
  25. }
  26.  
  27. public client_impulse(id, impulse)
  28. {
  29. if(impulse != 100)
  30. return PLUGIN_HANDLED_MAIN
  31. if(!hasLight[id])
  32. {
  33. client_print(id, print_chat, "[Zseblampa] Neked venned kell zseblampatipust, ird: /buylight")
  34. return PLUGIN_HANDLED_MAIN
  35. }
  36. return PLUGIN_CONTINUE
  37. }
  38.  
  39. public buyLight(id)
  40. {
  41. if(cs_get_user_money(id) < get_pcvar_num(p_FlashlightCost))
  42. {
  43. client_print(id, print_chat, "[Zseblampa] Nincs penzed zseblampara!")
  44. return PLUGIN_HANDLED
  45. }
  46. if(hasLight[id])
  47. {
  48. client_print(id, print_chat, "[Zseblampa] Nallad mar van zseblampa!")
  49. return PLUGIN_HANDLED
  50. }
  51. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(p_FlashlightCost), 1)
  52. client_print(id, print_chat, "[Zseblampa] Sikeresen vettel zseblampat!")
  53. hasLight[id] = true
  54. return PLUGIN_HANDLED
  55. }
  56.  
  57. public playerSpawn(id) hasLight[id] = false
  58.