AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]: adding vectors to each other and multipling vectors by integer (https://forums.alliedmods.net/showthread.php?t=164646)

Owyn 08-14-2011 05:57

[solved]: adding vectors to each other and multipling vectors by integer
 
hi, i need to get 30 units forward of player aiming origin,

trying to convert
PHP Code:

AMX_NATIVE_CALL get_user_aiming 

to AMXX but this part got me confused:
PHP Code:

Vector v_dest v_src v_forward static_cast<float>(params[4]); 

so it would be
PHP Code:

new Float:v_dest[3] = v_src v_forward 30// Float[3] = float[3] + float[3] * integer 

but that doesn't work in AMXX, what should i write in amxx to get simular calculations? :crab:

fysiks 08-14-2011 06:17

Re: how: adding vectors to each other and multipling vectors by integer
 
You just do it piece by piece:

PHP Code:

new Float:v_dest[3]
v_dest[0] = v_src[0] + v_forward[0] * 30.0
v_dest
[1] = v_src[1] + v_forward[1] * 30.0
v_dest
[2] = v_src[2] + v_forward[2] * 30.0 


ConnorMcLeod 08-14-2011 06:18

Re: how: adding vectors to each other and multipling vectors by integer
 
Use xs stocks

xs_vec_add xs_vec_scalar etc..

fysiks 08-14-2011 06:21

Re: how: adding vectors to each other and multipling vectors by integer
 
Quote:

Originally Posted by ConnorMcLeod (Post 1532223)
Use xs stocks

xs_vec_add xs_vec_scalar etc..

:arrow: xs_vec_mul_scalar

ConnorMcLeod 08-14-2011 06:23

Re: how: adding vectors to each other and multipling vectors by integer
 
W/E, he has to open xs.inc to have an idea about avalaible stocks :)

abdul-rehman 08-14-2011 06:50

Re: how: adding vectors to each other and multipling vectors by integer
 
you can try this:
Code:
stock get_user_aim_vector(id, vector_multiplier, Float:aim_vector[3]) {     static Float:angles[3]     pev(id, pev_v_angle, angles)         static Float:path[3]     angle_vector(angles, ANGLEVECTOR_FORWARD, path)     xs_vec_normalize(path, path)     xs_vec_mul_scalar(path, vector_multiplier, aim_vector) }

Owyn 08-14-2011 06:54

Re: how: adding vectors to each other and multipling vectors by integer
 
fysiks, thought about that but wasn't sure, thx


All times are GMT -4. The time now is 03:22.

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