 |
|
Veteran Member
|

01-26-2007
, 00:08
Re: Beam Help.
|
#7
|
Quote:
Originally Posted by blackops7799
I know it may not be the best code... but it works.
(first time using messages)
I wasn't sure what you wanted, so I made the beam go where you are aiming.
It's a little jumpy in-game.
Code:
#include <amxmodx>
#include <amxmisc>
new beamsprite
new rope_to[33][3]
new Float:rope_totaldis[33]
new beamon[33]
public plugin_init()
{
register_plugin("Beam Me", "1.1" , "blackops7799")
register_clcmd("say /beamme","beam")
}
public plugin_precache()
{
beamsprite = precache_model("sprites/dot.spr")
}
public beam(id)
{
if(beamon[id] == 1)
{
return PLUGIN_HANDLED
}
else
{
static origin1[3]
get_user_origin(id,origin1)
static Float:origin1_F[3]
origin1_F[0] = float(origin1[0])
origin1_F[1] = float(origin1[1])
origin1_F[2] = float(origin1[2])
static origin2[3]
get_user_origin(id,origin2,3)
rope_to[id][0]=origin2[0]
rope_to[id][1]=origin2[1]
rope_to[id][2]=origin2[2]
static Float:origin2_F[3]
origin2_F[0] = float(origin2[0])
origin2_F[1] = float(origin2[1])
origin2_F[2] = float(origin2[2])
static Float:distance[3]
distance[0] = floatabs(origin1_F[0] - origin2_F[0])
distance[1] = floatabs(origin1_F[1] - origin2_F[1])
distance[2] = floatabs(origin1_F[2] - origin2_F[2])
rope_totaldis[id] = floatsqroot(distance[0]*distance[0] + distance[1]*distance[1] + distance[2]*distance[2])
//Create green beam
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(1) //TE_BEAMENTPOINT
write_short(id) // start entity
write_coord(rope_to[id][0])
write_coord(rope_to[id][1])
write_coord(rope_to[id][2])
write_short(beamsprite)
write_byte(1) // framestart
write_byte(1) // framerate
write_byte(01) // life in 0.1's
write_byte(5) // width
write_byte(0) // noise
write_byte(255) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(1000) // brightness
write_byte(0) // speed
message_end()
set_task(0.01,"testbeam",id)
set_task(5.0,"stopbeam",id)
set_task(5.1,"resetbeam",id)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public stopbeam(id)
{
beamon[id] = 1
return PLUGIN_HANDLED
}
public resetbeam(id)
{
beamon[id] = 0
return PLUGIN_HANDLED
}
|
Are you sure that's your code?
__________________
Quote:
Originally Posted by phorelyph
your retatred
|
|
|
|
|