点通粉丝 发表于 2009-1-19 07:26:51

我也发个插件吧.在种莱和种草的基楚下改的

本帖最后由 点通粉丝 于 2009-1-19 07:55 编辑


#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
//----------------------------------------------------------------------------------------------

new haveplanted=0
public plugin_init()
{
        // Plugin Info
        register_plugin("Medkit & Plant","1.1","feige & duper/Rockell & X-man")
        register_cvar("amx_medkit", "1")
        register_cvar("amx_plantnum", "20")
        register_cvar("amx_medkithealth", "25")
        register_event("ResetHUD", "newRound","b")
        register_event("DeathMsg","deathevent","a")
        register_clcmd("amx_plant", "createPlant", ADMIN_SLAY)
}

//----------------------------------------------------------------------------------------------

public newRound()
{
        new chocolate = find_ent_by_class(-1, "chocolate")
        new plant = find_ent_by_class(-1, "plant")
        new pltnumber=get_cvar_num("amx_plantnum")
        //new hasmovenum=0
        while(chocolate) {
                remove_entity(chocolate)
                chocolate = find_ent_by_class(chocolate, "chocolate")
        }
        while(plant&&haveplanted>pltnumber) {
                remove_entity(plant)
                haveplanted=haveplanted-1
                plant = find_ent_by_class(plant, "plant")
               
        }
       
        return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------

public deathevent()
{
        if ( !get_cvar_num("amx_medkit") )
                return PLUGIN_CONTINUE
       
        new killer = read_data(1)
        new victim = read_data(2)
        if ( (killer != victim)||(killer == victim) )
        {
                createChocolate(victim)
                createPlant(victim)
        }
        if(is_user_connected(victim))
                cs_reset_user_model(victim)
        return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------

public createChocolate(victim)
{
        new Float:vAim, Float:vOrigin
        entity_get_vector(victim, EV_VEC_origin, vOrigin)
        VelocityByAim(victim, random_num(2, 4), vAim)
       
        vOrigin += (vAim-10)
        vOrigin += vAim
        vOrigin += 30.0
       
        new chocolate = create_entity("info_target")
        entity_set_string(chocolate, EV_SZ_classname, "chocolate")
        entity_set_model(chocolate, "models/w_medkit.mdl")
        entity_set_size(chocolate, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
        entity_set_int(chocolate, EV_INT_solid, 2)
        entity_set_int(chocolate, EV_INT_movetype, 6)
        entity_set_vector(chocolate, EV_VEC_origin, vOrigin)
}

//----------------------------------------------------------------------------------------------

public plugin_precache() {
        precache_model("models/w_medkit.mdl")
        precache_sound( "weapons/c4_disarm.wav")
        precache_model("models/uplant1.mdl")
        precache_model("models/uplant2.mdl")
        precache_model("models/uplant3.mdl")
}

//----------------------------------------------------------------------------------------------

public pfn_touch(ptr, ptd){
        if(!is_valid_ent(ptd) || !is_valid_ent(ptr))
                return PLUGIN_CONTINUE
       
        if(!is_user_connected(ptd) || !is_user_alive(ptd))
                return PLUGIN_CONTINUE
       
        new classname
        entity_get_string(ptr, EV_SZ_classname, classname, 31)
        if(equal(classname, "chocolate"))
        {
                new gOrigHealth = get_user_health(ptd)
                new health = gOrigHealth + get_cvar_num("amx_medkithealth")
                set_user_health(ptd, health)
                emit_sound(ptd,CHAN_VOICE,"weapons/c4_disarm.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                remove_entity(ptr)
        }
        return PLUGIN_CONTINUE
}   

public client_death(killer, victim, wpnindex, hitplace, TK)
{
        if(wpnindex == CSW_C4&& is_user_connected(victim))
                cs_reset_user_model(victim)
}


public createPlant(victim) {
        haveplanted=haveplanted+1
        new tmpPlant
        tmpPlant = create_entity("info_target")
        entity_set_string(tmpPlant, EV_SZ_classname, "plant")
        switch(random_num(1, 3))
        {
                case 1:
                {
                        entity_set_model(tmpPlant, "models/uplant1.mdl")
                }
                case 2:
                {
                        entity_set_model(tmpPlant, "models/uplant2.mdl")
                }
                case 3:
                {
                        entity_set_model(tmpPlant, "models/uplant3.mdl")
                }
        }
        new Float:MinBox
        new Float:MaxBox
       
        MinBox = -4.0        //4
        MinBox = -4.0        //4
        MinBox = -30.0        //35
        MaxBox =4.0
        MaxBox =4.0
        MaxBox =30.0
       
        // 10/85/125
        // 5/5/10uplant1
        // 4/4/35uplant3
        entity_set_vector(tmpPlant, EV_VEC_mins, MinBox)
        entity_set_vector(tmpPlant, EV_VEC_maxs, MaxBox)
        entity_set_vector(tmpPlant, EV_VEC_absmin, MinBox)
        entity_set_vector(tmpPlant, EV_VEC_absmax, MaxBox)
               
        new Float:PlayerOrigin
       
        entity_get_vector(victim, EV_VEC_origin, PlayerOrigin)
        PlayerOrigin=PlayerOrigin-38.0        //uplant1 =38
        PlayerOrigin=PlayerOrigin+10.0
        entity_set_origin(tmpPlant, PlayerOrigin)
        entity_set_int(tmpPlant, EV_INT_solid, 0)
        entity_set_int(tmpPlant, EV_INT_movetype, 4)
       
       
        return PLUGIN_HANDLED
}
适用版本CS1.5
种莱命令bind f amx_plant

死后变小草,有三种,
amx_plantnum 30 控制地图上草的数量;
amx_plant op种草

shote 发表于 2009-1-19 23:38:20

还1。5????

Z3327674 发表于 2009-1-20 08:25:38

很好的了 ,CS1.5毕竟人还是比较多的!

点通粉丝 发表于 2009-1-20 10:36:39

还1。5????
shote 发表于 2009-1-19 23:38 http://www.dt-club.net/forum/images/common/back.gif

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

点通粉丝 发表于 2009-1-20 10:40:37

据我所知CS1.6上的树模形自带所就有几十种啦
想点换都得..比1.5强多啦..儿CS1.5的自带植物只有三种草..唉

dole 发表于 2009-1-20 10:44:27

谢谢分享~CS1.6是主流啊~

summerice 发表于 2009-1-20 18:53:54

改一下试试,应该不错的.

Z3327674 发表于 2009-1-20 18:56:30

哈哈我去改种飞机,种CT ,种僵尸 。。。哈哈!

点通粉丝 发表于 2009-1-23 22:32:16

好一句.人生自古谁没挂![早晚会挂掉]..呵呵

seahoi 发表于 2009-1-30 00:48:21

0ce5ee21 路過支持一下,,謝謝分享
页: [1] 2
查看完整版本: 我也发个插件吧.在种莱和种草的基楚下改的