Raised This Month: $51 Target: $400
 12% 

TE_MODEL as entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mixtaz
Junior Member
Join Date: Sep 2017
Old 09-06-2018 , 06:40   TE_MODEL as entity
Reply With Quote #1

I have this simple piece of code

PHP Code:
public chickenthrow(id[])
{            
    if(
is_user_alive(id[0]) && chickens[id[0]] > 0)
    {
        new 
vec[3];
        new 
aimvec[3];
        new 
velocityvec[3];
        new 
length;
        new 
speed 800;
        
get_user_origin(id[0],vec);
        
get_user_origin(id[0],aimvec,2);
    
        
velocityvec[0]=aimvec[0]-vec[0];
        
velocityvec[1]=aimvec[1]-vec[1];
        
velocityvec[2]=aimvec[2]-vec[2];
    
        
length=sqrt(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2]);
    
        
velocityvec[0]=velocityvec[0]*speed/length;
        
velocityvec[1]=velocityvec[1]*speed/length;
        
velocityvec[2]=velocityvec[2]*speed/length;
    
        
// TE_MODEL from HL-SDK common/const.h 
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
        
write_byte(106);         // TE_MODEL index
        
write_coord(vec[0]);         // location coords
        
write_coord(vec[1]);
        
write_coord(vec[2]+20);
        
write_coord(velocityvec[0]);     // speed coords - stupid, but thats how its done
        
write_coord(velocityvec[1]);
        
write_coord(velocityvec[2]+100);
        
write_angle (0);         // yaw
        
write_short (mdlChicken);     // model 
        
write_byte (2);             // sound
        
write_byte (255);         // duration 
        
message_end();

    }
        
chickens[id[0]]--

And what I want to do is to make the thrown chickens an entity and make them explode afterwards.

Well most importantly making them an entity, cause I can handle the second task.
Mixtaz 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 20:56.


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