|
发表于 2009-1-19 07:02:18
|
显示全部楼层
|阅读模式
来自 中国–广东–广州–白云区
- #include <amxmodx>
- #include <cstrike>
- #include <engine>
- new g_bwEnt[33]
- new cvar_enable
- static const PLUGIN_NAME[] = "Back Weapons"
- static const PLUGIN_AUTHOR[] = "Cheap_Suit"
- static const PLUGIN_VERSION[] = "1.2"
- public plugin_init()
- {
- register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
- register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
- register_event("Damage", "Event_DamageDeath", "bd", "2>0")
- register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
- cvar_enable = register_cvar("amx_backweapons", "1")
- }
- public plugin_precache()
- {
- precache_model("models/p_ak47.mdl")
- precache_model("models/p_awp.mdl")
- precache_model("models/p_m4a1.mdl")
- precache_model("models/pshell.mdl")
- }
- public client_connect(id)
- {
- if(g_bwEnt[id] > 0)
- remove_entity(g_bwEnt[id])
- g_bwEnt[id] = 0
- }
- public client_disconnect(id)
- {
- if(g_bwEnt[id] > 0)
- remove_entity(g_bwEnt[id])
- g_bwEnt[id] = 0
- }
- public Event_DamageDeath(id)
- {
- if(g_bwEnt[id] > 0)
- remove_entity(g_bwEnt[id])
- g_bwEnt[id] = 0
- }
- public Event_CurWeapon(id)
- {
- if(!is_user_connected(id) || !is_user_alive(id))
- return PLUGIN_CONTINUE
- if(!cs_get_user_hasprim(id) && g_bwEnt[id] > 0)
- {
- remove_entity(g_bwEnt[id])
- g_bwEnt[id] = 0
- return PLUGIN_CONTINUE
- }
- if(!get_pcvar_num(cvar_enable) || !cs_get_user_hasprim(id))
- return PLUGIN_CONTINUE
- if(g_bwEnt[id] < 1)
- {
- g_bwEnt[id] = create_entity("info_target")
- if(g_bwEnt[id] > 0)
- {
- entity_set_int(g_bwEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
- entity_set_edict(g_bwEnt[id], EV_ENT_aiment, id)
- }
- }
- if(g_bwEnt[id] < 1)
- return PLUGIN_CONTINUE
- switch(read_data(2))
- {
- case CSW_KNIFE, CSW_C4, CSW_HEGRENADE, CSW_SMOKEGRENADE, CSW_FLASHBANG,
- CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_ELITE, CSW_FIVESEVEN:
- {
- new modelName[33], weaponID = get_weapon_id(id)
- get_model_name(weaponID, modelName, 32)
- if(equal(modelName, "models/pshell.mdl"))
- {
- set_entity_visibility(g_bwEnt[id], 0)
- return PLUGIN_CONTINUE
- }
- set_entity_visibility(g_bwEnt[id], 1)
- entity_set_model(g_bwEnt[id], modelName)
- }
- default: set_entity_visibility(g_bwEnt[id], 0)
- }
- return PLUGIN_CONTINUE
- }
- stock get_weapon_id(id)
- {
- new weapStr[32], iNum, weaponID
- get_user_weapons(id, weapStr, iNum)
- for(new i = 0; i < iNum; i++)
- {
- switch(weapStr[i])
- {
- case CSW_AK47, CSW_AUG, CSW_AWP, CSW_FAMAS, CSW_G3SG1, CSW_GALIL, CSW_M249,CSW_M3,
- CSW_M4A1, CSW_MP5NAVY, CSW_P90, CSW_SCOUT, CSW_SG550, CSW_SG552, CSW_UMP45, CSW_XM1014:
- {
- weaponID = weapStr[i]
- break
- }
- default: weaponID = 0
- }
- }
- return weaponID
- }
- stock get_model_name(weaponID, returnString[], returnLen)
- {
- new modelName
- switch(weaponID)
- {
- case CSW_AK47: modelName = format(returnString, returnLen, "models/p_ak47.mdl")
- case CSW_AWP: modelName = format(returnString, returnLen, "models/p_awp.mdl")
- case CSW_M4A1: modelName = format(returnString, returnLen, "models/p_m4a1.mdl")
- default: modelName = format(returnString, returnLen, "models/pshell.mdl")
- }
- return modelName
- }
复制代码 我将背枪插件改成这样.没问题
但为何.只有这三把枪可以.以其他枪就不可以呢.
背枪插件一共是十六把枪的
但是现在只能用三把到底为什么?????? |
|