I need some help with my lightning code
PHP Code:
public castlight(id)
{
new Float:fOrigin[3], Float:fVelocity[3]
entity_get_vector(id,EV_VEC_origin, fOrigin)
VelocityByAim(id, 35, fVelocity)
new iOrigin[3]
FVecIVec(fOrigin, iOrigin)
lightning(iOrigin, iTargetOrigin)
}
lightning(vec1[3], vec2[3])
{
//Lightning
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
// Here is the Problem
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
// Here is the Problem
write_short( light )
write_byte( 1 ) // framestart
write_byte( 5 ) // framerate
write_byte( 2 ) // life
write_byte( 20 ) // width
write_byte( 30 ) // noise
write_byte( 255 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte( 200 ) // brightness
write_byte( 200 ) // speed
message_end()
}
The problem is I cant figure out how to make the lightning go to the spot where you are aiming at . ( So this also needs to work if I aint aim at a person )
My next problem :
I need to shake somebodys screen when he/she gets hit but I cant get this right :
PHP Code:
/* plugin init */
ScreenShake = get_user_msgid("ScreenShake")
/**********/
/* Calling like this */
screen_shake(victim)
/**************/
public screen_shake(id)
{
message_begin(MSG_BROADCAST, ScreenShake, { 50, 50, 50 }, id);
write_short(8<<12);
write_short(5<<12);
write_short(4<<12);
write_byte(100);
write_byte(100);
write_byte(100);
write_byte(100);
message_end();
}
It doesnt crash me ore the server its just doing nothing .
Can sombody help me with this .
Thanks already cause I know you guys can (;
__________________