mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-01-03 16:13:34 +08:00
[server] Implement and match n_VectorSize(...)
This commit is contained in:
parent
4356777720
commit
d36c02eb05
@ -99,6 +99,7 @@ typedef unsigned short VEHICLEID;
|
||||
#include "actorpool.h"
|
||||
#include "netgame.h"
|
||||
#include "plugins.h"
|
||||
#include "mathutils.h"
|
||||
|
||||
// ---------
|
||||
// EXTERNALS
|
||||
|
12
server/mathutils.cpp
Normal file
12
server/mathutils.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
float GetLength(PVECTOR vec)
|
||||
{
|
||||
return (float)sqrt((vec->X * vec->X) + (vec->Y * vec->Y) + (vec->Z * vec->Z));
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
3
server/mathutils.h
Normal file
3
server/mathutils.h
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
float GetLength(PVECTOR vec);
|
||||
|
@ -141,10 +141,16 @@ static cell AMX_NATIVE_CALL n_CallLocalFunction(AMX *amx, cell *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// native Float:VectorSize(Float:x, Float:y, Float:z)
|
||||
static cell AMX_NATIVE_CALL n_VectorSize(AMX *amx, cell *params)
|
||||
{
|
||||
// TODO: VectorSize
|
||||
return 0;
|
||||
VECTOR vec;
|
||||
vec.X = amx_ctof(params[1]);
|
||||
vec.Y = amx_ctof(params[2]);
|
||||
vec.Z = amx_ctof(params[3]);
|
||||
float fResult = GetLength(&vec);
|
||||
return amx_ftoc(fResult);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -399,6 +399,12 @@
|
||||
<File
|
||||
RelativePath=".\main.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mathutils.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mathutils.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\menupool.cpp">
|
||||
</File>
|
||||
|
Loading…
x
Reference in New Issue
Block a user