HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. ================================================================================
  3. AMX Mod Plugin
  4. http://amxmod.net
  5. --------------------------------------------------------------------------------
  6. Name : Graves
  7. Author : Freecode <Freecode@hotmail.com>
  8. --------------------------------------------------------------------------------
  9. Graves v 2.0
  10.   Created by Freecode
  11.  
  12.   Graves
  13.   ================
  14.   On death a grave will be placed where you died.
  15.  
  16.   USAGE
  17.   =====
  18.  
  19.   amx_grave <1 = ON || 0 = OFF>
  20.   amx_graveyard <1 = ON || 0 = OFF>
  21.  
  22.   Releases:
  23.   ========
  24.   2003-10-27 version 1.0:
  25.   First version
  26.  
  27.   2003-10-27 version 2.0:
  28.   Fixed graves. Now stay untill the end of round.
  29.   Added amx_graveyard <1/0>
  30.  
  31.   TO DO
  32.   =====
  33.   -Fix Models
  34.  
  35. --------------------------------------------------------------------------------
  36. Installation :
  37. - Extract file grave.amx to directory addons/amx/plugins
  38. - Open addons/amx/plugins/plugins.ini
  39. - Add a line containing : grave.amx
  40. - Place the graves[id] folder into models directory.
  41. ex.- cstrike/models/graves[id]/
  42. ====================================================================
  43. */
  44. #include <amxmodx>
  45. #include <engine>
  46. #include <amxmisc>
  47.  
  48. /********GLOBAL*VARIABLES*******/
  49. new graveyard = 0
  50. new graves[32]
  51. new nGrave = 0
  52. /********END*GLOBAL*VARIABLES*******/
  53.  
  54. /********GRAVE*CONTROL*******/
  55. public grave(id,level,cid)
  56. {
  57. if (!cmd_access(id,level,cid,1))
  58. return PLUGIN_HANDLED
  59.  
  60. new arg[32]
  61. read_argv(1,arg,31)
  62. if(arg[0] == '1')
  63. {
  64. nGrave = 1
  65. graveyard = 0
  66. console_print(id,"[AMX] Sirok megjelenese bekapcsolva.")
  67. }
  68. else if(arg[0] == '0')
  69. {
  70. nGrave = 0
  71. console_print(id,"[AMX] Sirok megjelenese kikapcsolva.")
  72. }
  73.  
  74. return PLUGIN_HANDLED
  75. }
  76. /********END*GRAVE*CONTROL*******/
  77.  
  78. /********GRAVEYARD*CONTROL*******/
  79. public graveyardc(id,level,cid)
  80. {
  81. if (!cmd_access(id,level,cid,1))
  82. return PLUGIN_HANDLED
  83.  
  84. new arg1[32]
  85. read_argv(1,arg1,31)
  86. if(arg1[0] == '1')
  87. {
  88. nGrave = 1
  89. graveyard = 1
  90. console_print(id,"[AMX] Temeto bekapcsolva.")
  91. }
  92. else if(arg1[0] == '0')
  93. {
  94. graveyard = 0
  95. console_print(id,"[AMX] Temeto kikapcsolva.")
  96. }
  97.  
  98. return PLUGIN_HANDLED
  99. }
  100. /********END*GRAVEYARD*CONTROL*******/
  101.  
  102. /********GRAVECODE*******/
  103. public make_gave(id)
  104. {
  105. if(nGrave == 1 || graveyard == 1)
  106. {
  107. new victim = read_data(2)
  108. new origin[3]
  109. new Float:fOrigin[3]
  110. get_user_origin(victim,origin)
  111.  
  112. fOrigin[0]=float(origin[0])
  113. fOrigin[1]=float(origin[1])
  114. fOrigin[2]=float(origin[2])
  115.  
  116. graves[id] = create_entity("info_target")
  117. entity_set_string(graves[id], EV_SZ_classname, "grave")
  118. if(get_user_team(victim) == 1)
  119. entity_set_model(graves[id],"models/graves/t.mdl")
  120. else
  121. entity_set_model(graves[id],"models/graves/ct.mdl")
  122. entity_set_origin(graves[id], fOrigin)
  123. entity_set_int(graves[id], EV_INT_solid, 2)
  124. entity_set_int(graves[id], EV_INT_movetype, 4)
  125. entity_set_edict(graves[id], EV_ENT_owner, victim)
  126. }
  127. return PLUGIN_HANDLED
  128. }
  129. /********END*GRAVECODE*******/
  130.  
  131. public NewRound(id)
  132. {
  133. if(nGrave == 1 && graveyard != 1)
  134. {
  135. new gGrave[32]
  136. new iGrave = find_ent_by_tname(-1, "grave")
  137. while(iGrave > 0)
  138. {
  139. entity_get_string(iGrave, EV_SZ_classname, gGrave, 31)
  140. if(equal(gGrave, "grave") )
  141. remove_entity(iGrave)
  142.  
  143. iGrave = find_ent_by_tname(-1, "grave")
  144. }
  145.  
  146. }
  147. }
  148.  
  149. public plugin_precache()
  150. {
  151. precache_model("models/graves/ct.mdl")
  152. precache_model("models/graves/t.mdl")
  153. }
  154.  
  155. public plugin_init()
  156. {
  157. register_plugin("Graves","2.0","Freecode")
  158. register_event("DeathMsg","make_gave","a")
  159. register_event("ResetHUD","NewRound","bc")
  160. register_clcmd("amx_grave","grave",ADMIN_BAN,"1/0")
  161. register_clcmd("amx_graveyard","graveyardc",ADMIN_BAN,"1/0")
  162. }
  163.