关于人物发光代码请教一下.怎设为像灯光一样的效果
#include <amxmodx>#include <fun>
#define PAST 10
new position // array to store positions for every player (position)
// = newest position, = oldest position
new mode_cvar, team_cvar, speed_cvar, glow_cvar;
// primary function
public set_alpha()
{
new mode= get_pcvar_num(mode_cvar)
new team= get_pcvar_num(team_cvar)
new speed = get_pcvar_num(speed_cvar)
new glow= get_pcvar_num(glow_cvar)
// if ghosts_mode is not in range, disable plugin
if (mode < 0 || mode > 2)
{
mode = 0
set_pcvar_num(mode_cvar, 0)
}
// if ghosts_team, ghosts_speed or ghosts_glow are not in range, fix them
if (team < 0 || team > 2)
{
team = 0
set_pcvar_num(team_cvar, 0)
}
if (speed < 1)
{
speed = 1
set_pcvar_num(speed_cvar, 1)
}
else
if (speed > 50)
{
speed = 50
set_pcvar_num(speed_cvar, 50)
}
if (glow < 0)
{
glow = 0
set_pcvar_num(glow_cvar, 0)
}
else
if (glow > 100)
{
glow = 100
set_pcvar_num(glow_cvar, 100)
}
new player, number, i
get_players(player, number)
// if the plugin is disabled, render the players correctly
if (mode != 1 && mode != 2)
{
for (i = 0; i < number; i++)
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
return PLUGIN_CONTINUE
}
new distance, j, x, y, z, player_team
for (i = 0; i < number; i++)
{
// check if player is allowed to be a ghost
player_team = get_user_team(player)
if (player_team != team)
{
// shift all positions one right to make room for the new position
for (j = PAST - 1; j > 0; j--)
{
position] = position]
position] = position]
position] = position]
}
get_user_origin(player, position]) // get the new position
// compute distance traveled in the last PAST frames
distance = 0
for (j = 1; j < PAST; j++)
{
x = position] - position]
y = position] - position]
z = position] - position]
distance += sqroot(x * x + y * y + z * z)
}
distance /= (PAST - 1) // make average distance; PAST points => PAST - 1 lines
// make the player transparent or glow
if (distance > speed)
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0) // moving very fast :)
else
if (mode == 2 && distance < speed * glow / 100) // if condition is true then glow
if (player_team == 1)
set_user_rendering(player, kRenderFxGlowShell, 0, 191, 255, kRenderNormal, 5) // CT
else
set_user_rendering(player, kRenderFxGlowShell, 255, 255, 0, kRenderNormal, 5) // T
else // partially visible (or totaly if not moving)
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255 - 255 * distance / speed)
}
else
{
set_user_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25) // normal rendering
}
}
return PLUGIN_CONTINUE
}
// when a new round begins, set all the positions of the players to their original one (or players will be invisible when round begins)
public new_round(id)
{
new mode = get_pcvar_num(mode_cvar)
if (mode == 1 || mode == 2)
{
get_user_origin(id, position)
new i
for (i = 1; i < PAST; i++)
{
position = position
position = position
position = position
}
}
return PLUGIN_CONTINUE
}
// not interesting
public plugin_init()
{
register_plugin("Ghosts", "0.3a", "Spike7d8")
register_event("ResetHUD", "new_round", "b")
set_task(0.1, "set_alpha", 0, "", 0, "b")
mode_cvar= register_cvar("ghosts_mode","2")
team_cvar= register_cvar("ghosts_team","0")
speed_cvar = register_cvar("ghosts_speed", "25000")
glow_cvar= register_cvar("ghosts_glow","25000")
}
1# 点通粉丝
我就想把他改到脚以下位置都有那发光的效果
像开灯照着那种..请问怎样才可实现?? 哈哈! 学习学习啊! 老大辛苦了啊! 这个渲染函数是对整个实体进行渲染的,不能渲染模型的一部分…… 2# 点通粉丝
jnmjbnkmbkjbjbm b ,mb ,mbm, 1# 点通粉丝
师傅我来了,你到原地了吗? 看看 、 求高人出现实现代码
页:
[1]