HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5. #include <cstrike>
  6. #include <hamsandwich>
  7. #include <fakemeta_util>
  8. #define BOXMODEL "models/hl2box.mdl"
  9. #define BOXSOUND "debris/bustcrate1.wav"
  10. #define BOXBLOCK "fvox/bell.wav"
  11. #define PLUGIN "HL2 boxes"
  12. #define VERSION "1.0"
  13. #define AUTHOR "MaHu"
  14. new cvar_cost
  15. public plugin_init() {
  16. register_plugin(PLUGIN, VERSION, AUTHOR)
  17. register_clcmd("say /box","box");
  18. register_clcmd("say_team /box","box");
  19. register_clcmd("say /doboz","box");
  20. register_clcmd("say_team /doboz","box");
  21. cvar_cost = register_cvar("box_cost","5000");
  22. RegisterHam(Ham_TakeDamage, "func_breakable", "fwdBreakableTakeDamage", 1)
  23. }
  24.  
  25.  
  26. public plugin_precache(){
  27. precache_model(BOXMODEL)
  28. precache_model("models/woodgibs.mdl")
  29. precache_sound("debris/bustcrate1.wav")
  30. precache_sound("debris/bustcrate2.wav")
  31. precache_sound("debris/bustcrate3.wav")
  32. precache_sound("debris/bustglass2.wav")
  33. precache_sound(BOXSOUND)
  34. precache_sound(BOXBLOCK)
  35. }
  36.  
  37.  
  38. public box(id,ent){
  39. if(cs_get_user_money(id) < get_pcvar_num(cvar_cost)){
  40. client_print(id,print_chat,"you need $%d to use box",get_pcvar_num(cvar_cost))
  41. emit_sound(id, CHAN_ITEM, BOXBLOCK, 1.0, ATTN_NORM, 0, PITCH_NORM)
  42. return
  43. }
  44.  
  45. new bablo = cs_get_user_money(id)
  46. new Float:fVelocity[3], Float:fOrigin[3]
  47. new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_breakable"))
  48. fm_set_kvd(ent, "material", "1", "func_breakable")
  49. dllfunc(DLLFunc_Spawn, ent)
  50. emit_sound(id, CHAN_ITEM, BOXSOUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
  51. cs_set_user_money(id,bablo - get_pcvar_num(cvar_cost))
  52. entity_get_vector(id, EV_VEC_origin, fOrigin)
  53. VelocityByAim(id, 34, fVelocity)
  54.  
  55. fOrigin[0] += fVelocity[0]
  56. fOrigin[1] += fVelocity[1]
  57.  
  58. VelocityByAim(id, 300, fVelocity)
  59. entity_set_string(ent, EV_SZ_classname, "hl2box")
  60. entity_set_model(ent, BOXMODEL)
  61. entity_set_size(ent, Float:{ -10.0, -10.0, 0.0 }, Float:{ 10.0, 10.0, 25.0 })
  62. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  63. entity_set_vector(ent, EV_VEC_origin, fOrigin)
  64. entity_set_float(ent, EV_FL_health, 200.0)
  65. entity_set_float(ent, EV_FL_takedamage, DAMAGE_AIM)
  66. entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
  67. entity_set_int(ent, EV_INT_sequence, 0)
  68. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01)
  69. drop_to_floor(ent)
  70. }
  71. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  72. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  73. */
  74.