AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   C++ -> AMXX velocity length? (https://forums.alliedmods.net/showthread.php?t=128086)

HLM 05-28-2010 16:47

C++ -> AMXX velocity length?
 
I have a line of c++ code that I have been trying to convert to AMXX [pawn] (its from a large metamod plugin, im converting)

anyways.. the line is
PHP Code:

if(pEntity->v.velocity.Length() > || pEntity->v.maxspeed <= || pEntity->v.deadflag != DEAD_NO

I know how to modify everything except for velocity.Length(), I do not know what I should use for this (the entity is a player) I have seen a few things regarding length, but still, I dont know exactly what to use.

Thanks for considering to help me :)

Alka 05-28-2010 16:58

Re: C++ -> AMXX velocity length?
 
Get entity velocity then use
PHP Code:

vector_length(:args

native.

->
PHP Code:

new Float:vVel[3];
pev(idpev_velocityvVel);

if(
vector_length(vVel) > 0)
   
//something... 


HLM 05-28-2010 17:41

Re: C++ -> AMXX velocity length?
 
much obliged, so im going to be getting the velocity stored to a vector, then use vector_length(), and all will work? if so, thank you very much!

Seta00 05-28-2010 19:21

Re: C++ -> AMXX velocity length?
 
FYI, the length of a vector corresponds to
Code:

sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[3])
Or the square root of the sum of the squares of its components.

fysiks 05-28-2010 20:43

Re: C++ -> AMXX velocity length?
 
Quote:

Originally Posted by Seta00 (Post 1193846)
FYI, the length of a vector corresponds to
Code:

sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[3])
Or the square root of the sum of the squares of its components.

aka magnitude.

jim_yang 05-28-2010 22:37

Re: C++ -> AMXX velocity length?
 
you can look at the header file vector.h in sdk to see how this method defined.

TSuNaMi_ 05-29-2010 07:36

Re: C++ -> AMXX velocity length?
 
what is default step lenght in cs ?

Exolent[jNr] 05-31-2010 02:13

Re: C++ -> AMXX velocity length?
 
Quote:

Originally Posted by TSuNaMi_ (Post 1194235)
what is default step lenght in cs ?

Each weapon has their own max speed:
http://wiki.amxmodx.org/CS_Weapons_Information


All times are GMT -4. The time now is 05:15.

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