ttboy 发表于 2007-3-26 18:01:33

请帮我看下扔雷换刀的这段代码,有个问题!

最近扔雷炸服麻烦死,因此得到扔雷换刀的插件,但是,听冰河说,C4也能炸服, 真是没办法,于是自己动手,依葫芦画瓢,改了了一下,把前换扔雷的代码加到了后面,但可能不知道CS武器代码,扔C4换刀无效请帮我看看哪里错了。
我改了三个地方。请教,哪里错了。
new const sModel_c4_w[] = "models/w_c4.mdl"

register_event("CurWeapon", "event_CurWeapon_CheckWeapon", "be", "1>0", "2!4", "2!9", "2!29", "2!25", "2!6")

|| ( !equal(sModel, sModel_HeGrenade_w) && !equal(sModel, sModel_SmokeGrenade_w) && !equal(sModel, sModel_FlashBang_w) && !equal(sModel, sModel_c4_w)) )

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN_NAME        "knife_after_throw_nade"
#define PLUGIN_VERSION        "0.1"
#define PLUGIN_AUTHOR        "CZ*Ryu"

#define MAXPLAYERS 32

new iUserLastWeaponID

new const sWeaponBox[] = "weaponbox"
new const sNamedEnt_ArmouryEntity[] = "armoury_entity"
new const sWeaponKnife[] = "weapon_knife"

new const sModel_Weaponbox_w[] = "models/w_weaponbox.mdl"
new const sModel_FlashBang_w[] = "models/w_flashbang.mdl"
new const sModel_HeGrenade_w[] = "models/w_hegrenade.mdl"
new const sModel_SmokeGrenade_w[] = "models/w_smokegrenade.mdl"
new const sModel_c4_w[] = "models/w_c4.mdl"
public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_event("CurWeapon", "event_CurWeapon_CheckWeapon", "be", "1>0", "2!4", "2!9", "2!29", "2!25", "2!6")
        register_forward(FM_SetModel, "FM_SetModel_SetKnife")
}

public event_CurWeapon_CheckWeapon(id)
{
        iUserLastWeaponID = read_data(2)
}

public FM_SetModel_SetKnife(iEnt, sModel[])
{
        if ( !pev_valid(iEnt)
        || equal(sModel, sModel_Weaponbox_w)
        || ( !equal(sModel, sModel_HeGrenade_w) && !equal(sModel, sModel_SmokeGrenade_w) && !equal(sModel, sModel_FlashBang_w) && !equal(sModel, sModel_c4_w)) )
                return FMRES_IGNORED
       
        new sClass
        pev(iEnt, pev_classname, sClass, sizeof sClass - 1 )
        if ( equal(sClass, sWeaponBox) || equal(sClass, sNamedEnt_ArmouryEntity) )
                return FMRES_IGNORED
       
        new iOwner = pev(iEnt, pev_owner)
        new iWeaponID = iUserLastWeaponID
        if ( iOwner && is_user_alive(iOwner) && pev(iOwner, pev_weapons) & (1 <<iWeaponID) )
        {
                get_weaponname(iWeaponID, sClass, sizeof sClass - 1 )
                client_cmd(iOwner, sClass)
                client_cmd(iOwner, sWeaponKnife)
        }
        return FMRES_IGNORED
}
       

sunlei85106 发表于 2011-11-27 09:09:21

sunlei85106 发表于 2011-11-27 09:10:57

guozheng 发表于 2011-11-28 12:51:59

那怎么办?
页: [1]
查看完整版本: 请帮我看下扔雷换刀的这段代码,有个问题!