问个问题..希望有人能解答一下.谢谢
#include <amxmodx>#include <cstrike>
#include <engine>
new g_bwEnt
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 > 0)
remove_entity(g_bwEnt)
g_bwEnt = 0
}
public client_disconnect(id)
{
if(g_bwEnt > 0)
remove_entity(g_bwEnt)
g_bwEnt = 0
}
public Event_DamageDeath(id)
{
if(g_bwEnt > 0)
remove_entity(g_bwEnt)
g_bwEnt = 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 > 0)
{
remove_entity(g_bwEnt)
g_bwEnt = 0
return PLUGIN_CONTINUE
}
if(!get_pcvar_num(cvar_enable) || !cs_get_user_hasprim(id))
return PLUGIN_CONTINUE
if(g_bwEnt < 1)
{
g_bwEnt = create_entity("info_target")
if(g_bwEnt > 0)
{
entity_set_int(g_bwEnt, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(g_bwEnt, EV_ENT_aiment, id)
}
}
if(g_bwEnt < 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, weaponID = get_weapon_id(id)
get_model_name(weaponID, modelName, 32)
if(equal(modelName, "models/pshell.mdl"))
{
set_entity_visibility(g_bwEnt, 0)
return PLUGIN_CONTINUE
}
set_entity_visibility(g_bwEnt, 1)
entity_set_model(g_bwEnt, modelName)
}
default: set_entity_visibility(g_bwEnt, 0)
}
return PLUGIN_CONTINUE
}
stock get_weapon_id(id)
{
new weapStr, iNum, weaponID
get_user_weapons(id, weapStr, iNum)
for(new i = 0; i < iNum; i++)
{
switch(weapStr)
{
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
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
}我将背枪插件改成这样.没问题
但为何.只有这三把枪可以.以其他枪就不可以呢.
背枪插件一共是十六把枪的
但是现在只能用三把到底为什么?????? 大家不防试试效果还几好看的..1.51.6都可以的
页:
[1]