AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] ref to float (https://forums.alliedmods.net/showthread.php?t=82704)

Dr.G 12-28-2008 13:08

[help] ref to float
 
Hi.. I need a way to ref to like 5 set of origins that have 3 values... Like:

PHP Code:

new Float:ent_origins[5][3] = { { -258.0,1789.0,190.0 },{ 300.0,1015.0,190.0 },{ 45.0,897.0,199.0 },
910.0,-237.0,145.0 },{ 284.0,-324.0,140.0 } } 

But how do i ref those to a function? Normally i would do like this with a single origin:

PHP Code:

public SetModel()
{
new 
Float:origin[3
 
origin[0] = 258.0
 origin
[1] = 1789.0
 origin
[2] = 190.0
 
 set_pev
(entpev_originorigin)


But how do i ref. the 5 origins above?

Thanks in advance

Hawk552 12-28-2008 19:41

Re: [help] ref to float
 
For starters, it's better to use the following function to set entity origins using Fakemeta:

Code:
engfunc(EngFunc_SetOrigin,ent,origin)

This will update all values such as bounds on the entity as opposed to just setting the origin which won't do these things.

With that out of the way, you would reference those origins by passing the value of the first dimension you want to use. The 2d array "ent_origins" can be seen as really being 5 arrays, each with 3 cells inside of them. If you want to reference the 2nd origin, you'd pass this as your parameter:

Code:
ent_origins[1]

So to actually set the origin, it would be:

Code:
engfunc(EngFunc_SetOrigin,ent,ent_origins[1])

This would set the ent's origin to 300.0,1015.0,190.0.

Dr.G 12-29-2008 05:24

Re: [help] ref to float
 
Thanks


All times are GMT -4. The time now is 09:19.

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