AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]Lightning (target problem) , ScreenShake (https://forums.alliedmods.net/showthread.php?t=76534)

grimvh2 08-26-2008 11:12

[solved]Lightning (target problem) , ScreenShake
 
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_originfOrigin)
    
VelocityByAim(id35fVelocity)
    
    new 
iOrigin[3]
    
FVecIVec(fOriginiOrigin)
    
    
lightning(iOriginiTargetOrigin)
}

lightning(vec1[3], vec2[3]) 

   
//Lightning 
   
message_beginMSG_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_shortlight 
   
write_byte// framestart 
   
write_byte// framerate 
   
write_byte// life 
   
write_byte20 // width 
   
write_byte30 // noise 
   
write_byte255 // r, g, b 
   
write_byte255 // r, g, b 
   
write_byte255 // r, g, b 
   
write_byte200 // brightness 
   
write_byte200 // 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_BROADCASTScreenShake, { 505050 }, 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 (;

anakin_cstrike 08-26-2008 11:27

Re: Lightning (target problem) , ScreenShake
 
For problem 2 - ScreenShake: try this:
PHP Code:

new ScreenShake
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Damage""evn_damage""b""2!0""3=0""4!0");
    
ScreenShake get_user_msgid("ScreenShake")
}
public 
evn_damage(victim)
{
    new 
attacker get_user_attacker(victim);
    if(
get_user_team(victim) != get_user_team(attacker))
        
screen_shake(victim);
}
public 
screen_shake(index)
{
    if(
is_user_connected(index))
    {
        
message_begin(MSG_ONE,ScreenShake,{0,0,0},index);
        
write_short(1<<13);
        
write_short(1<<13);
        
write_short(1<<13);
        
message_end();
    }



ConnorMcLeod 08-26-2008 11:28

Re: Lightning (target problem) , ScreenShake
 
Use mode 3 of get_user_origin

http://www.amxmodx.org/funcwiki.php?...igin&go=search

grimvh2 08-26-2008 11:47

Re: Lightning (target problem) , ScreenShake
 
Thx connor , that should normmaly work ( I hope )

,

for the screenshake : you dind had to give me the event and all , but thanks

also I just found a plugin that does same effect .

edit : thx connor , tested and working :D
edit2: Screenshake also working .

Thanks guys , that was really fast .


All times are GMT -4. The time now is 03:14.

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