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.