Raised This Month: $ Target: $400
 0% 

[SOLVED] Get Entity origin|vector|velocity..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 06-24-2010 , 18:17   [SOLVED] Get Entity origin|vector|velocity..
Reply With Quote #1

how I know origin=vector=velocity

but when I try to get for example "button" origins[3]

<fakemeta>
Code:
new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
     new Float:origin[3];
     pev(iEntity, pev_velocity, origin)
     server_print("%f ",origin[0]);
     server_print("%f ",origin[1]);
     server_print("%f ",origin[2]);
}
stock fm_find_ent_by_class(index, const classname[])
    return engfunc(EngFunc_FindEntityByString, index, "classname", classname)
and I will test this:
Code:
new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
     new Float:origin[3];
     pev(iEntity, pev_origin, origin)
     server_print("%f ",origin[0]);
     server_print("%f ",origin[1]);
     server_print("%f ",origin[2]);
}
stock fm_find_ent_by_class(index, const classname[])
    return engfunc(EngFunc_FindEntityByString, index, "classname", classname)
always return

server print:
Code:
0.000000
0.000000
0.000000
so, I think this function pev_velocity,pev_origin work only to "players"?

how to get Entity [button,doors..] origins?

Last edited by AngeIII; 10-17-2012 at 17:28.
AngeIII is offline
Send a message via Skype™ to AngeIII
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-24-2010 , 18:20   Re: Get Entity origin|vector|velocity..
Reply With Quote #2

I guess you are trying to get pev_origin of brush (button, doors?) wich will always equal to { 0, 0, 0 }, you have to use get_brush_entity_origin( )
__________________
xPaw is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 06-24-2010 , 18:25   Re: Get Entity origin|vector|velocity..
Reply With Quote #3

oh.. maybe

Code:
stock fm_get_brush_entity_origin(index, Float:origin[3]) {
    new Float:mins[3], Float:maxs[3];

    pev(index, pev_origin, origin);
    pev(index, pev_mins, mins);
    pev(index, pev_maxs, maxs);

    origin[0] += (mins[0] + maxs[0]) * 0.5;
    origin[1] += (mins[1] + maxs[1]) * 0.5;
    origin[2] += (mins[2] + maxs[2]) * 0.5;

    return 1;
}
Yeeah It's Work Thank You xPaw

Code:
new iEntity;
while( ( iEntity = fm_find_ent_by_class( iEntity, "func_button" ) ) > 0 )
{
     new Float:origin[3];
     fm_get_brush_entity_origin(iEntity,origin)
     server_print("%f ",origin[0]);
     server_print("%f ",origin[1]);
     server_print("%f ",origin[2]);
}

Last edited by AngeIII; 06-24-2010 at 18:28.
AngeIII is offline
Send a message via Skype™ to AngeIII
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2010 , 23:25   Re: Get Entity origin|vector|velocity..
Reply With Quote #4

Quote:
Originally Posted by AngeIII View Post
oh.. maybe

Code:
stock fm_get_brush_entity_origin(index, Float:origin[3]) {
    new Float:mins[3], Float:maxs[3];

    pev(index, pev_origin, origin);
    pev(index, pev_mins, mins);
    pev(index, pev_maxs, maxs);

    origin[0] += (mins[0] + maxs[0]) * 0.5;
    origin[1] += (mins[1] + maxs[1]) * 0.5;
    origin[2] += (mins[2] + maxs[2]) * 0.5;

    return 1;
}
No. Use what xPaw said.
__________________
fysiks is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-25-2010 , 03:15   Re: Get Entity origin|vector|velocity..
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
No. Use what xPaw said.
It's fine since not fm_ is stock as well
__________________
xPaw is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 06-25-2010 , 18:10   Re: Get Entity origin|vector|velocity..
Reply With Quote #6

what is better?
<fakemeta>
Code:
stock fm_get_brush_entity_origin(index, Float:origin[3]) {
    new Float:mins[3], Float:maxs[3];

    pev(index, pev_origin, origin);
    pev(index, pev_mins, mins);
    pev(index, pev_maxs, maxs);

    origin[0] += (mins[0] + maxs[0]) * 0.5;
    origin[1] += (mins[1] + maxs[1]) * 0.5;
    origin[2] += (mins[2] + maxs[2]) * 0.5;

    return 1;
}
or <engine>
Code:
stock get_brush_entity_origin(ent, Float:orig[3])
{
    new Float:Min[3], Float:Max[3];

    entity_get_vector(ent, EV_VEC_origin, orig);
    entity_get_vector(ent, EV_VEC_mins, Min);
    entity_get_vector(ent, EV_VEC_maxs, Max);
    
    orig[0] += (Min[0] + Max[0]) * 0.5;
    orig[1] += (Min[1] + Max[1]) * 0.5;
    orig[2] += (Min[2] + Max[2]) * 0.5;

    return 1;
}
i'm using fakemeta work good

Last edited by AngeIII; 06-25-2010 at 18:17.
AngeIII is offline
Send a message via Skype™ to AngeIII
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2010 , 19:23   Re: Get Entity origin|vector|velocity..
Reply With Quote #7

Quote:
Originally Posted by xPaw View Post
It's fine since not fm_ is stock as well
Oh. lol.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 14:53.


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