View Single Post
panxiaohai
Senior Member
Join Date: Mar 2010
Old 08-03-2011 , 04:22   Re: [L4D2] Remote Control Aircraft
Reply With Quote #8

Quote:
Originally Posted by alexip121093 View Post
Try to create a info_particle_target to the target position and give it a name
Then set its name to the control point 1 of the particle
Thank you for your help, it works very well, thak you again.

Code:
ShowTrack(Float:pos[3], Float:ang[3], Float:length)
{
    new Float:vec[3];
    new Float:endpos[3];
    GetAngleVectors(ang, vec, NULL_VECTOR, NULL_VECTOR);
    NormalizeVector(vec, vec);
    ScaleVector(vec,length);
    AddVectors(pos, vec, endpos);
    
    decl String:particlename[64]="weapon_tracers_50cal";
    decl String:temp[64]="";
    
    new target = CreateEntityByName("info_particle_target");
    Format(temp, 64, "cptarget%d", target);
    DispatchKeyValue(target, "targetname", temp);    
    TeleportEntity(target, endpos, NULL_VECTOR, NULL_VECTOR); 
    ActivateEntity(target); 
    
    new particle = CreateEntityByName("info_particle_system");
    DispatchKeyValue(particle, "effect_name", particlename);
    DispatchKeyValue(particle, "cpoint1", temp);
    DispatchSpawn(particle);
    ActivateEntity(particle); 
    TeleportEntity(particle, pos, NULL_VECTOR, NULL_VECTOR);
    AcceptEntityInput(particle, "start");    
}
panxiaohai is offline