Raised This Month: $ Target: $400
 0% 

set a players view on an entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 07-13-2008 , 14:20   set a players view on an entity
Reply With Quote #1

i searched but i could not find anything. can anyone tell me how to set pev_v_angle of a player on an entity?
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-13-2008 , 14:37   Re: set a players view on an entity
Reply With Quote #2

You can't. On ents you must use pev_angle .
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 07-13-2008 , 15:08   Re: set a players view on an entity
Reply With Quote #3

i do not want to change an entitys angle. i want to make a player looking at an entity. i thought i just need to use fm_get_brush_entity_origin and then change the players pev_v_angle but it didnt work either.
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-13-2008 , 18:49   Re: set a players view on an entity
Reply With Quote #4

Hum, just today i thought of somehting like this, dunno how it can be done, but i think there might be a way...i will search
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
travo
Senior Member
Join Date: Aug 2006
Old 07-14-2008 , 08:03   Re: set a players view on an entity
Reply With Quote #5

i might be misunderstanding you but I think this is what you are wanting (just ignore me if it isnt)

PHP Code:
// base via chr_engine from ghw_chronic
stock set_user_aim(id,  target)
{
    if (
pev_valid(id) && pev_valid(target))
    {
        static 
aFloat:ent_origin[3], Float:origin[3], Float:v_lengthFloat:aim_vector[3], Float:new_angles[3];
        
pev(idpev_originent_origin);
        
pev(targetpev_originorigin);

        for (
0;3a++) 
            
origin[a] -= ent_origin[a];
        
v_length vector_length(origin);
        for (
0;3a++) 
            
aim_vector[a] = origin[a] / v_length;

        
vector_to_angle(aim_vectornew_angles);
        
new_angles[0] *= -1;

        if(
new_angles[1] > 180.0new_angles[1] -= 360;
        else if(
new_angles[1] <- 180.0new_angles[1] += 360;
        else if(
new_angles[1] == 180.0 || new_angles[1] == -180.0new_angles[1] = -179.999999;

        
set_pev(idpev_anglesnew_angles);
        
set_pev(idpev_v_anglenew_angles);
        
set_pev(idpev_fixangle1);
        
        return 
1;
    }
    return 
0;


Last edited by travo; 07-14-2008 at 08:05.
travo is offline
Reply



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 07:06.


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