Raised This Month: $ Target: $400
 0% 

get user aim angle and change it (htfiwdt??)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-22-2007 , 08:22   get user aim angle and change it (htfiwdt??)
Reply With Quote #1

does anyone know how to get players aim angle and then set it with a slight modification ?

so i could change the angle of players aim for recoil things, hand shaking etc.(CS Reality mod :>)

thx
__________________

Last edited by Voi; 04-22-2007 at 08:25.
Voi is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 04-22-2007 , 08:40   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #2

I found that snippet to get the user aiming-angle:
Code:
 #include <amxmodx>
 #include <engine>

 new Float:oldAngles[33][3];

 public client_PreThink(id)
 {
    static Float:angles[3];
    entity_get_vector(id,EV_VEC_v_angle,angles);

    if(angles[0] < oldAngles[id][0])
    {
        client_print(id,print_chat,"UP");
    }
    else if(angles[0] > oldAngles[id][0])
    {
        client_print(id,print_chat,"DOWN");
    }

    if(angles[1] < oldAngles[id][1])
    {
        client_print(id,print_chat,"RIGHT");
    }
    else if(angles[1] > oldAngles[id][1])
    {
        client_print(id,print_chat,"LEFT");
    }

    oldAngles[id] = angles;
 }
I think with entity_set_vector()
(http://www.amxmodx.org/doc/source/fu...set_vector.htm)
you can set an angle

Hope that helps!?

greetz regalis
__________________
regalis is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-22-2007 , 10:41   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #3

thx, but what i am doing wrong here ?
Code:
public moving(id, mode)
{
    if(mode == 1)
    {
        
    new Float:anglesnew[3], Float:angles[3]
    entity_get_vector(id,EV_VEC_v_angle,angles)    
    anglesnew[0] = angles[0] + random_float(-10.5,10.5)
    anglesnew[1] = angles[1] + random_float(-11.0,11.0)
    anglesnew[2] = angles[2] + random_float(-10.5,10.5)
    entity_set_vector ( id, 0, anglesnew)
    
    
    }
    if(mode == 2)
    {
        
    new Float:anglesnew[3], Float:angles[3]
    entity_get_vector(id,EV_VEC_v_angle,angles)    
    anglesnew[0] = angles[0] + random_float(-20.5,20.5)
    anglesnew[1] = angles[1] + random_float(-21.0,21.0)
    anglesnew[2] = angles[2] + random_float(-20.5,20.5)
    entity_set_vector ( id, 0, anglesnew)
    
    
    }
}
instead changing aim the entity_set_vector is moving player to some location pls help
Attached Files
File Type: sma Get Plugin or Get Source (voi_sniperrealism.sma - 929 views - 7.0 KB)
__________________

Last edited by Voi; 04-22-2007 at 11:01.
Voi is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 04-22-2007 , 11:15   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #4

If i'm not wrong i thing you are changing one angle that shouldn't be changed...
Code:
       if(mode == 1)
    {
        
    new Float:anglesnew[3], Float:angles[3]
    entity_get_vector(id,EV_VEC_v_angle,angles)    
    anglesnew[0] = angles[0] + random_float(-10.5,10.5)
    anglesnew[1] = angles[1] + random_float(-11.0,11.0)
    //anglesnew[2] = angles[2] + random_float(-10.5,10.5)
    entity_set_vector ( id, 0, anglesnew)
    
    
    }
    if(mode == 2)
    {
        
    new Float:anglesnew[3], Float:angles[3]
    entity_get_vector(id,EV_VEC_v_angle,angles)    
    anglesnew[0] = angles[0] + random_float(-20.5,20.5)
    anglesnew[1] = angles[1] + random_float(-21.0,21.0)
    //anglesnew[2] = angles[2] + random_float(-20.5,20.5)
    entity_set_vector ( id, 0, anglesnew)
    
    
    }
I have no experience with that stuff but please try that

greetz regalis
__________________
regalis is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-22-2007 , 11:34   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #5

nope, its almost the same thing
__________________
Voi is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-22-2007 , 11:38   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #6

You did not specify what vector to change:
Vector 0 is EV_VEC_origin, so i think you are trowing the player of the map

change:
entity_set_vector ( id, 0, anglesnew)
to:
entity_set_vector ( id, EV_VEC_v_angle, anglesnew)

For list of all vectors and others:
http://www.amxmodx.org/funcwiki.php?go=module&id=3


and, you can use instead of:
anglesnew[0] = angles[0] + random_float(-20.5,20.5)
anglesnew[1] = angles[1] + random_float(-21.0,21.0)
anglesnew[2] = angles[2] + random_float(-20.5,20.5)
to:
angles[0] += random_float(-20.5,20.5)
angles[1] += random_float(-21.0,21.0)
angles[2] += random_float(-20.5,20.5)
entity_set_vector ( id, EV_VEC_v_angle, angles)
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 04-22-2007 at 11:44.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-22-2007 , 11:53   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #7

thx! im trying it!

edit:
doesnt work:
Code:
public moving(id, mode)
{
    new Float:angles[3]
    entity_get_vector(id,EV_VEC_v_angle,angles)
    if(mode == 1)
    {
    angles[0] += random_float(-20.5,20.5)
    angles[1] += random_float(-21.0,21.0)
    angles[2] += random_float(-20.5,20.5)
    entity_set_vector ( id, EV_VEC_v_angle, angles)
    }
    if(mode == 2)
    {
        
    angles[0] += random_float(-20.5,20.5)
    angles[1] += random_float(-21.0,21.0)
    angles[2] += random_float(-20.5,20.5)
    entity_set_vector ( id, EV_VEC_v_angle, angles)    
   
  }
}
but i have read somewhere that if i want to change aim vector i must set pev_fixaim 1 or something
__________________

Last edited by Voi; 04-22-2007 at 11:59.
Voi is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-22-2007 , 12:03   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #8

Hmm... hold on, let me try


EDIT:
Ok this works:
PHP Code:
public testtt(id){
    
    if (!(
get_user_flags(id)&ADMIN_MAP))
        return 
PLUGIN_HANDLED
    
    
new Float:angles[3]
    
entity_get_vector(id,EV_VEC_v_angle,angles)

    
angles[0] += random_float(-20.5,20.5)
    
angles[1] += random_float(-21.0,21.0)  

    
entity_set_vector idEV_VEC_v_angleangles)  
    
entity_set_int(id,EV_INT_fixangle,1)
    return 
PLUGIN_HANDLED

And it is true, the third value of angle is alweys 0..
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 04-22-2007 at 12:28.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 04-22-2007 , 12:34   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #9

now it works but not exacly how it ment to be

try voi_sniperrealism2.sma
it should work similiar to voi_sniperrealism.sma
Attached Files
File Type: sma Get Plugin or Get Source (voi_sniperrealism2.sma - 1008 views - 6.9 KB)
File Type: sma Get Plugin or Get Source (voi_sniperrealism.sma - 891 views - 6.8 KB)
__________________
Voi is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 04-22-2007 , 12:59   Re: get user aim angle and change it (htfiwdt??)
Reply With Quote #10

hmm... I see what you want

You want a plugin that set's player view up and down while he walks

-I do not think you need to use ScrShake, it is just too much
-The correct would the player view go up and down, but you are just setting random numbers, I would say to do something to the player's view go up and a little to one side one time, and down and a little to the other side
-You are executing moving(id, mode) two times in check_movement(playerid[]), and one time even if the player is not moving

-I never sow someone use this:
PHP Code:
switch ( is_user_bot id ) )
       {
             case 
1:
             return 
PLUGIN_CONTINUE
       

I think the correct is:
PHP Code:
if(is_user_bot(id))
       return 
PLUGIN_CONTINUE 
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
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 06:46.


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