|
一般的手雷拖尾都是以下面的形式编写的:
[php]if (grenadeid) {
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( TE_BEAMFOLLOW )
write_short(grenadeid) // entity
write_short(m_iTrail) // model
write_byte( 10 ) // life
write_byte( 5 ) // width
write_byte( 0 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte( 0 ) // r, g, b
}[/php]
不过我发现魔兽插件里兽族手雷拖尾是这样定义的:
[php]Create_TE_BEAMFOLLOW(index, g_siTrail, 20, 10, 255, 255, 0, 196)[/php]
我模仿着编写了一个仅仅适用于手雷(O4)的拖尾代码,不过编译不了,麻烦高手看看到底是什么原因。
[php]#include <amxmodx>
#include <engine>
#define TE_BEAMFOLLOW 22
new m_iTrail
public plugin_init()
{
register_plugin("Grenade Trail","1.0","X-man")
register_event("SendAudio","FireInTheHole","bc","2=%!MRAD_FIREINHOLE")
register_cvar("amx_grentrail","1")
}
public plugin_precache() {
m_iTrail = precache_model("sprites/smoke.spr")
}
public FireInTheHole()
{
if( !get_cvar_num("amx_grentrail") )
return PLUGIN_HANDLED
new id = read_data(1)
set_task(0.3, "grenid", id)
return PLUGIN_HANDLED
}
public grenid(id){
new grenadeid = get_grenade(id)
new clip, ammo, wpnid = get_user_weapon(id,clip,ammo)
if (wpnid == CSW_HEGRENADE)
if (grenadeid) {
Create_TE_BEAMFOLLOW(id, m_iTrail, 20, 10, 255, 255, 0, 196)
}
}[/php] |
|