Raised This Month: $12 Target: $400
 3% 

get ent origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 09-01-2011 , 14:29   get ent origin
Reply With Quote #1

PHP Code:
new Float:timer_origin[3]
    new 
entszTarget[17];
    while( (
ent engfunc(EngFunc_FindEntityByStringent"classname""func_button")) )
    {        
        
pev(entpev_targetszTarget16);
        
        
        
        if( 
equali(szTarget"counter_start"0)
        || 
equali(szTarget"clockstartbutton"0)
        || 
equali(szTarget"firsttimerelay"0)
        || 
equali(szTarget"but_start"0
        || 
equali(szTarget"counter_start_button"0
        || 
equali(szTarget"timer_startbutton"0
        || 
equali(szTarget"timer_startbutto"0
        || 
equali(szTarget"start_timer_emi"0
        || 
equali(szTarget"gogogo"0)
        || 
equali(szTarget"cbm_start",0))
        {
            
pev(entpev_origintimer_origin);
            
server_print("%0.2f,%0.2f,%0.2f",timer_origin[0],timer_origin[1],timer_origin[2])

            break
        }
    } 
it return 0.00 0.00 0.00
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-01-2011 , 14:49   Re: get ent origin
Reply With Quote #2

If those entities are created by the map, try get_brush_entity_origin()

Also consider using Trie to check those names instead of all the equali's.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 09-01-2011 , 15:07   Re: get ent origin
Reply With Quote #3

Quote:
Originally Posted by drekes View Post
If those entities are created by the map, try get_brush_entity_origin()

Also consider using Trie to check those names instead of all the equali's.
It's work now,thanks!

but i don't know how to use trie
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-01-2011 , 15:16   Re: get ent origin
Reply With Quote #4

Easy as 1 2 3.
Code:
new Trie:g_buttonStartTargets; public plugin_init() {     g_buttonStartTargets = TrieCreate();     TrieSetCell(g_buttonStartTargets, "counter_start", 1);     // ... } // ... if(TrieKeyExists(g_buttonStartTargets, szTarget)) {     // start button }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 09-01-2011 , 16:13   Re: get ent origin
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
Easy as 1 2 3. Code:
new Trie:g_buttonStartTargets; public plugin_init() { g_buttonStartTargets = TrieCreate(); TrieSetCell(g_buttonStartTargets, "counter_start", 1); // ... } // ... if(TrieKeyExists(g_buttonStartTargets, szTarget)) { // start button }
PHP Code:
    new const szStarts[ ][ ] = {
        
"counter_start""clockstartbutton""firsttimerelay""but_start""counter_start_button",
        
"multi_start""timer_startbutton""start_timer_emi""gogogo","cbm_start"
    
};
    
    for(new 
0sizeof szStartsi++ )
        
TrieSetCellg_tStartsszStarts], );
        

    
    new 
entszTarget[17];
    while( (
ent engfunc(EngFunc_FindEntityByStringent"classname""func_button")) )
    {        
        
pev(entpev_targetszTarget16);
        
        
        if(
TrieKeyExists(g_tStartsszTarget)) 
        {
            
get_brush_entity_origin(ent,timer_origin);
           
server_print("server_print("%0.2f,%0.2f,%0.2f",timer_origin[0],timer_origin[1],timer_origin[2])")
            break
        }
    } 
am i correct?
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!
biscuit628 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-01-2011 , 19:25   Re: get ent origin
Reply With Quote #6

Yeah, that's correct.

You would have known in 2 minutes by testing it instead of waiting 3 hours for someone to tell you it's right.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-02-2011 , 08:20   Re: get ent origin
Reply With Quote #7

That server print is wrong tough, take a closer look at it.
__________________
Hunter-Digital is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-02-2011 , 08:53   Re: get ent origin
Reply With Quote #8

Quote:
Originally Posted by Hunter-Digital View Post
That server print is wrong tough, take a closer look at it.
Indeed, didn't notice.
I guess OP has found it himself since he didn't reply anymore.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 20:56.


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