搜索
查看: 4845|回复: 19

[AMXX 带源码] 我也发个插件吧.在种莱和种草的基楚下改的

[复制链接]
发表于 2009-1-19 07:26:51 | 显示全部楼层 |阅读模式 来自 中国–广东–广州–白云区
本帖最后由 点通粉丝 于 2009-1-19 07:55 编辑

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <fun>
  5. #include <cstrike>
  6. //----------------------------------------------------------------------------------------------

  7. new haveplanted=0
  8. public plugin_init()
  9. {
  10.         // Plugin Info
  11.         register_plugin("Medkit & Plant","1.1","feige & duper/Rockell & X-man")
  12.         register_cvar("amx_medkit", "1")
  13.         register_cvar("amx_plantnum", "20")
  14.         register_cvar("amx_medkithealth", "25")
  15.         register_event("ResetHUD", "newRound","b")
  16.         register_event("DeathMsg","deathevent","a")
  17.         register_clcmd("amx_plant", "createPlant", ADMIN_SLAY)
  18. }

  19. //----------------------------------------------------------------------------------------------

  20. public newRound()
  21. {
  22.         new chocolate = find_ent_by_class(-1, "chocolate")
  23.         new plant = find_ent_by_class(-1, "plant")
  24.         new pltnumber=get_cvar_num("amx_plantnum")
  25.         //new hasmovenum=0
  26.         while(chocolate) {
  27.                 remove_entity(chocolate)
  28.                 chocolate = find_ent_by_class(chocolate, "chocolate")
  29.         }
  30.         while(plant&&haveplanted>pltnumber) {
  31.                 remove_entity(plant)
  32.                 haveplanted=haveplanted-1
  33.                 plant = find_ent_by_class(plant, "plant")
  34.                
  35.         }
  36.        
  37.         return PLUGIN_CONTINUE
  38. }
  39. //----------------------------------------------------------------------------------------------

  40. public deathevent()
  41. {
  42.         if ( !get_cvar_num("amx_medkit") )
  43.                 return PLUGIN_CONTINUE
  44.        
  45.         new killer = read_data(1)
  46.         new victim = read_data(2)
  47.         if ( (killer != victim)  ||(killer == victim) )
  48.         {
  49.                 createChocolate(victim)
  50.                 createPlant(victim)
  51.         }
  52.         if(is_user_connected(victim))
  53.                 cs_reset_user_model(victim)
  54.         return PLUGIN_CONTINUE
  55. }
  56. //----------------------------------------------------------------------------------------------

  57. public createChocolate(victim)
  58. {
  59.         new Float:vAim[3], Float:vOrigin[3]
  60.         entity_get_vector(victim, EV_VEC_origin, vOrigin)
  61.         VelocityByAim(victim, random_num(2, 4), vAim)
  62.        
  63.         vOrigin[0] += (vAim[0]-10)
  64.         vOrigin[1] += vAim[1]
  65.         vOrigin[2] += 30.0
  66.        
  67.         new chocolate = create_entity("info_target")
  68.         entity_set_string(chocolate, EV_SZ_classname, "chocolate")
  69.         entity_set_model(chocolate, "models/w_medkit.mdl")
  70.         entity_set_size(chocolate, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
  71.         entity_set_int(chocolate, EV_INT_solid, 2)
  72.         entity_set_int(chocolate, EV_INT_movetype, 6)
  73.         entity_set_vector(chocolate, EV_VEC_origin, vOrigin)
  74. }

  75. //----------------------------------------------------------------------------------------------

  76. public plugin_precache() {
  77.         precache_model("models/w_medkit.mdl")
  78.         precache_sound( "weapons/c4_disarm.wav")
  79.         precache_model("models/uplant1.mdl")
  80.         precache_model("models/uplant2.mdl")
  81.         precache_model("models/uplant3.mdl")
  82. }

  83. //----------------------------------------------------------------------------------------------

  84. public pfn_touch(ptr, ptd){
  85.         if(!is_valid_ent(ptd) || !is_valid_ent(ptr))
  86.                 return PLUGIN_CONTINUE
  87.        
  88.         if(!is_user_connected(ptd) || !is_user_alive(ptd))
  89.                 return PLUGIN_CONTINUE
  90.        
  91.         new classname[32]
  92.         entity_get_string(ptr, EV_SZ_classname, classname, 31)
  93.         if(equal(classname, "chocolate"))
  94.         {
  95.                 new gOrigHealth = get_user_health(ptd)
  96.                 new health = gOrigHealth + get_cvar_num("amx_medkithealth")
  97.                 set_user_health(ptd, health)
  98.                 emit_sound(ptd,CHAN_VOICE,"weapons/c4_disarm.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  99.                 remove_entity(ptr)
  100.         }
  101.         return PLUGIN_CONTINUE
  102. }   

  103. public client_death(killer, victim, wpnindex, hitplace, TK)
  104. {
  105.         if(wpnindex == CSW_C4  && is_user_connected(victim))
  106.                 cs_reset_user_model(victim)
  107. }


  108. public createPlant(victim) {
  109.         haveplanted=haveplanted+1
  110.         new tmpPlant
  111.         tmpPlant = create_entity("info_target")
  112.         entity_set_string(tmpPlant, EV_SZ_classname, "plant")
  113.         switch(random_num(1, 3))
  114.         {
  115.                 case 1:
  116.                 {
  117.                         entity_set_model(tmpPlant, "models/uplant1.mdl")
  118.                 }
  119.                 case 2:
  120.                 {
  121.                         entity_set_model(tmpPlant, "models/uplant2.mdl")
  122.                 }
  123.                 case 3:
  124.                 {
  125.                         entity_set_model(tmpPlant, "models/uplant3.mdl")
  126.                 }
  127.         }
  128.         new Float:MinBox[3]
  129.         new Float:MaxBox[3]
  130.        
  131.         MinBox[0] = -4.0        //4
  132.         MinBox[1] = -4.0        //4
  133.         MinBox[2] = -30.0        //35
  134.         MaxBox[0] =  4.0
  135.         MaxBox[1] =  4.0
  136.         MaxBox[2] =  30.0
  137.        
  138.         // 10/85/125
  139.         // 5/5/10  uplant1
  140.         // 4/4/35  uplant3
  141.         entity_set_vector(tmpPlant, EV_VEC_mins, MinBox)
  142.         entity_set_vector(tmpPlant, EV_VEC_maxs, MaxBox)
  143.         entity_set_vector(tmpPlant, EV_VEC_absmin, MinBox)
  144.         entity_set_vector(tmpPlant, EV_VEC_absmax, MaxBox)
  145.                
  146.         new Float:PlayerOrigin[3]
  147.        
  148.         entity_get_vector(victim, EV_VEC_origin, PlayerOrigin)
  149.         PlayerOrigin[2]=PlayerOrigin[2]-38.0        //uplant1 =38
  150.         PlayerOrigin[0]=PlayerOrigin[0]+10.0
  151.         entity_set_origin(tmpPlant, PlayerOrigin)
  152.         entity_set_int(tmpPlant, EV_INT_solid, 0)
  153.         entity_set_int(tmpPlant, EV_INT_movetype, 4)
  154.        
  155.        
  156.         return PLUGIN_HANDLED
  157. }
复制代码
适用版本CS1.5
种莱命令bind f amx_plant

死后变小草,有三种,
amx_plantnum 30 控制地图上草的数量;
amx_plant op种草
发表于 2009-1-19 23:38:20 | 显示全部楼层 来自 中国–广西–防城港
还1。5????
回复

使用道具 举报

发表于 2009-1-20 08:25:38 | 显示全部楼层 来自 中国–浙江–丽水–缙云县
很好的了 ,CS1.5毕竟人还是比较多的!
回复

使用道具 举报

 楼主| 发表于 2009-1-20 10:36:39 | 显示全部楼层 来自 中国–广东–广州–白云区
还1。5????
shote 发表于 2009-1-19 23:38


楼主你是笨笨吗..有了源码你想点都得啦..只要把相关模形换一下CS1.6上用其实效果是最好的
只不我不喜欢1.6儿而
回复

使用道具 举报

 楼主| 发表于 2009-1-20 10:40:37 | 显示全部楼层 来自 中国–广东–广州–白云区
据我所知CS1.6上的树模形自带所就有几十种啦
想点换都得..比1.5强多啦..儿CS1.5的自带植物只有三种草..唉

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

发表于 2009-1-20 10:44:27 | 显示全部楼层 来自 中国–北京–北京
~CS1.6~
回复

使用道具 举报

发表于 2009-1-20 18:53:54 | 显示全部楼层 来自 中国–广东–惠州
改一下试试,应该不错的.
回复

使用道具 举报

发表于 2009-1-20 18:56:30 | 显示全部楼层 来自 中国–浙江–丽水–缙云县
哈哈我去改种飞机,种CT ,种僵尸 。。。哈哈!
回复

使用道具 举报

 楼主| 发表于 2009-1-23 22:32:16 | 显示全部楼层 来自 中国–广东–广州–白云区
好一句.人生自古谁没挂![早晚会挂掉]..呵呵
回复

使用道具 举报

发表于 2009-1-30 00:48:21 | 显示全部楼层 来自 中国–香港
0ce5ee21 路過支持一下,,謝謝分享
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表