Raised This Month: $ Target: $400
 0% 

vector beam problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-31-2010 , 17:56   Re: vector beam problem
Reply With Quote #4

Before calling the TE_ message TE_BEAMENTPOINT, call the message TE_KILLBEAM

It should be like this:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <xs>

new sprite;

public 
plugin_init()
{
    
register_plugin("Laser Beam""1.0""stupok")
    
    
register_forward(FM_PlayerPreThink"fw_playerprethink")
}

public 
plugin_precache()
{
    
sprite precache_model("sprites/laserbeam.spr");
}

public 
fw_playerprethink(id)
{
    
show_beam(id)
}

public 
show_beam(id)
{
    static 
Float:fStart[3], Float:fEnd[3];
    static 
tr;
    
    
pev(idpev_originfStart)
    
velocity_by_aim(id9999fEnd)
    
xs_vec_add(fStartfEndfEnd)
    
trace_line(idfStartfEndfEnd)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_KILLBEAM)
    
write_short(id)
    
message_end()
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
    
write_byte(1);
    
write_short(id 0x1000); // start entity
    
engfunc(EngFunc_WriteCoordfEnd[0])
    
engfunc(EngFunc_WriteCoordfEnd[1])
    
engfunc(EngFunc_WriteCoordfEnd[2])
    
write_short(sprite); // sprite index
    
write_byte(0); // starting frame
    
write_byte(0); // frame rate in 0.1's
    
write_byte(1); // life in 0.1's
    
write_byte(10); // line wdith in 0.1's
    
write_byte(0); // noise amplitude in 0.01's
    
write_byte(0); // red
    
write_byte(0); // green
    
write_byte(255); // blue
    
write_byte(255); // brightness
    
write_byte(255); // scroll speed in 0.1's
    
message_end();
    
    return 
PLUGIN_HANDLED;

Btw, I optimized it.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 07-31-2010 at 18:04.
meTaLiCroSS is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode