|
发表于 2004-7-3 17:19:05
|
显示全部楼层
来自 中国–广东–深圳
所有的雷都有轨迹的代码如下:(在amxx下通过)
#include <amxmodx>
#include <engine>
/*
The cvar is controlled like this
sv_grentrail 0 = No Grentrail
sv_grentrail 1 = All Green Trails
sv_grentrail 2 = Random Colors
sv_grentrail 3 = Team Specific (Tested In CS...)
*/
#define TE_BEAMFOLLOW 22
//new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl"
new m_iTrail
public plugin_init()
{
register_plugin("Grentrail","1.2","AssKicR")
register_event("TextMsg","TextMsg","b","2&#Game_radio", "4&#Fire_in_the_hole")
register_cvar("sv_grentrail","0")
}
public plugin_precache() {
m_iTrail = precache_model("sprites/smoke.spr")
}
public TextMsg()
{
if(get_cvar_num("sv_grentrail") == 0)
return PLUGIN_HANDLED
new name[32]
read_data(3, name, 31)
new id = get_user_index(name)
set_task(1.0, "grenid", id)
return PLUGIN_HANDLED
}
public grenid(id){
new string[32], grenadeid = 0
grenadeid = get_grenade(id)
entity_get_string(grenadeid,EV_SZ_model,string,31)
if (grenadeid) { /* && equali(HEGRENADE_MODEL,string)*/
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
if (get_cvar_num("sv_grentrail")==1) {
write_byte( 0 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte( 0 ) // r, g, b
}
else if (get_cvar_num("sv_grentrail")==2)
{
new red = random_num(0,255)
new green = random_num(0,255)
new blue = random_num(0,255)
write_byte( red ) // r, g, b
write_byte( green ) // r, g, b
write_byte( blue ) // r, g, b
}
else if (get_cvar_num("sv_grentrail")==3)
{
if (get_user_team(id)==1) // Terrorist
{
write_byte( 255 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
}
else // Counter-Terrorist
{
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 255 ) // r, g, b
}
}
else
{
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
write_byte( 0 ) // r, g, b
}
switch (random_num(0,2))
{
case 0:write_byte( 64 ) // brightness
case 1:write_byte( 128 ) // brightness
case 2:write_byte( 192 ) // brightness
}
message_end() // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
}
} |
|