entity_set_aim(ent, const Float:origin2[3]){
if(!pev_valid(ent))
return 0;
static Float:origin[3];
xs_vec_copy(origin2,origin)
static Float:ent_origin[3]
pev(ent,pev_origin,ent_origin);
if(is_user_alive(ent)){
new Float:fOfs[3];
pev(ent,pev_view_ofs,fOfs)
xs_vec_add(ent_origin,fOfs,ent_origin);
}
xs_vec_sub(origin,ent_origin,origin);
static Float:aim_vector[3];
xs_vec_div_scalar(origin,vector_length(origin),aim_vector)
static Float:new_angles[3];
vector_to_angle(aim_vector,new_angles);
new_angles[0] *= -1;
if(new_angles[1]>180.0) new_angles[1] -= 360;
if(new_angles[1]<-180.0) new_angles[1] += 360;
if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999;
set_pev(ent,pev_angles,new_angles);
set_pev(ent,pev_fixangle,1);
return 1;
}ustawia on aby ent/gracz patrzył na podane przez nas origin (czyli patrzy na podany przez nas punkt)- Pierwszy parametr to id gracza/enta
- Drugi to origin punktu na jaki ma patrzeć (Float tablica 3 wartościowa)
wymaga fakemeta i xs
#include <fakemeta> #include <xs>
Użytkownik DarkGL edytował ten post 15.09.2012 11:43


Dodatki SourceMod















