Raised This Month: $ Target: $400
 0% 

[help] ref to float


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-28-2008 , 13:08   [help] ref to float
Reply With Quote #1

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
__________________
Dr.G is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-28-2008 , 19:41   Re: [help] ref to float
Reply With Quote #2

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.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-29-2008 , 05:24   Re: [help] ref to float
Reply With Quote #3

Thanks
__________________
Dr.G is offline
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 09:19.


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