HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #include <fakemeta_util>
  5. #include <zombieplague>
  6. #include <hamsandwich>
  7. #include <fakemeta>
  8. #include <engine>
  9.  
  10. #define PLUGIN "Ammo a foldon"
  11. #define VERSION "1.0"
  12. #define AUTHOR "?????"
  13.  
  14. enum cvar
  15. {
  16. giveammo
  17. }
  18.  
  19. new pcvar[cvar]
  20.  
  21. new const item_class_name[] = "ammo"
  22.  
  23. /* Here you can change the model */
  24. new g_model[] = "models/zm-modellek/ammo-a-foldon.mdl"
  25.  
  26. /* Here is the sound, when you take it */
  27. new sound[] = { "zm-hangok/ammo-a-foldon.wav" }
  28.  
  29. public plugin_precache()
  30. {
  31. precache_model(g_model)
  32. precache_sound(sound)
  33. }
  34.  
  35. public plugin_init()
  36. {
  37. register_plugin(PLUGIN, VERSION, AUTHOR)
  38.  
  39. register_forward(FM_Touch, "fwd_Touch")
  40.  
  41. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  42.  
  43. register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0")
  44.  
  45. pcvar[giveammo] = register_cvar("zp_awards_give_ammo", "100")
  46. }
  47.  
  48. public EVENT_round_start()
  49. {
  50. deleteAllItems()
  51. }
  52.  
  53. public deleteAllItems()
  54. {
  55. new ent = FM_NULLENT
  56. static string_class[] = "classname"
  57. while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
  58. set_pev(ent, pev_flags, FL_KILLME)
  59. }
  60.  
  61. public addItem(origin[3])
  62. {
  63. new ent = fm_create_entity("info_target")
  64. set_pev(ent, pev_classname, item_class_name)
  65.  
  66. engfunc(EngFunc_SetModel,ent, g_model)
  67.  
  68. set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0})
  69. set_pev(ent,pev_maxs,Float:{10.0,10.0,25.0})
  70. set_pev(ent,pev_size,Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
  71. engfunc(EngFunc_SetSize,ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})
  72.  
  73. set_pev(ent,pev_solid,SOLID_BBOX)
  74. set_pev(ent,pev_movetype,MOVETYPE_TOSS)
  75.  
  76. new Float:fOrigin[3]
  77. IVecFVec(origin, fOrigin)
  78. set_pev(ent, pev_origin, fOrigin)
  79.  
  80. set_pev(ent,pev_renderfx,kRenderFxGlowShell)
  81.  
  82. new Float:velocity[3];
  83. pev(ent,pev_velocity,velocity);
  84. velocity[2] = random_float(265.0,285.0);
  85. set_pev(ent,pev_velocity,velocity)
  86.  
  87. switch(random_num(1,4))
  88. {
  89. case 1: set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0})
  90. case 2: set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0})
  91. case 3: set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0})
  92. case 4: set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0})
  93. }
  94. }
  95.  
  96. public fwd_Touch(toucher, touched)
  97. {
  98. if (!is_user_alive(toucher) || !pev_valid(touched))
  99. return FMRES_IGNORED
  100.  
  101. new classname[32]
  102. pev(touched, pev_classname, classname, 31)
  103.  
  104. if (!equal(classname, item_class_name))
  105. return FMRES_IGNORED
  106.  
  107. zp_set_user_ammo_packs(toucher, zp_get_user_ammo_packs(toucher) + get_pcvar_num(pcvar[giveammo]))
  108. emit_sound(toucher, CHAN_AUTO, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  109. set_pev(touched, pev_effects, EF_NODRAW)
  110. set_pev(touched, pev_solid, SOLID_NOT)
  111.  
  112. return FMRES_IGNORED
  113.  
  114. }
  115.  
  116. public fw_PlayerKilled(victim, attacker, shouldgib)
  117. {
  118. new origin[3]
  119. get_user_origin(victim , origin)
  120.  
  121. addItem(origin)
  122. }
  123. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  124. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  125. */
  126.