Raised This Month: $ Target: $400
 0% 

get func_door entity id handled by func_button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
YakumoHiratsuhi
Veteran Member
Join Date: Dec 2010
Location: Dreαmlαnd.
Old 01-31-2013 , 11:32   get func_door entity id handled by func_button
Reply With Quote #1

The topic name say it all, i need that to open the cells in jailbreak maps, i know not all maps handle doors this way, but most of them do, i tried to get the target of the button using a integer, but its not a valid entity, i got a code but im not sure why fakemeta throws this error: Invalid return type when using strings.

here's the code to open the cells, mappers usually set the same targetname to all the doors of the main button to open them.

PHP Code:
// Open cells automatically
open_cells()
{
    
// Loop through all buttons that open doors and activate them
    
new ent FM_NULLENTtarget[32], classname[32], targetent FM_NULLENT;
    
    while (((
ent engfunc(EngFunc_FindEntityByStringent"classname""func_button")) != 0))
    {
        
// Not valid
        
if(!pev_valid(ent))
            continue;
        
        
// Get target name
        
pev(entpev_targettargetcharsmax(target))
        
        
// Search for doors
        
while (((targetent engfunc(EngFunc_FindEntityByStringent"targetname"target)) != 0))
        {
            
// Not valid
            
if(!pev_valid(targetent))
                continue;
            
            
// Get target ent
            
pev(targetentpev_classnamecharsmax(classname))
            
console_print(0"Entidad del boton %d con el identificador %d y clase %s"enttargetentclassname)
            
            
// Not a door ._.
            
if(!equal(classname"func_door") && !equal(classname"func_door_rotating"))
                continue;
            
            
// Use the button
            
dllfunc(DLLFunc_Useent0)
            
set_pev(entpev_frame0.0)
        }
    }

__________________
"Podra parecer ridiculo o imposible, pero este es el camino que seguimos los verdaderos hombres, si hay un muro en el camino, lo derribamos, si no hay camino, haremos uno, con nuestras propias manos, porque el magma de nuestro corazón arde en llamas."

Last edited by YakumoHiratsuhi; 01-31-2013 at 11:34.
YakumoHiratsuhi is offline
Send a message via MSN to YakumoHiratsuhi
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-31-2013 , 11:59   Re: get func_door entity id handled by func_button
Reply With Quote #2

pev(targetent, pev_classname, charsmax(classname))
->
pev(targetent, pev_classname, classname, charsmax(classname))
jimaway is offline
YakumoHiratsuhi
Veteran Member
Join Date: Dec 2010
Location: Dreαmlαnd.
Old 01-31-2013 , 16:55   Re: get func_door entity id handled by func_button
Reply With Quote #3

Thanks so much, its working now, btw you know which entities have the pev_target field assigned? just to handle much more maps
EDIT: Here is a list of entities that have a target keyvalue to open doors (maybe i missed some)

Quote:
button_target
func_button
momentary_rot_button
trigger_multiple
trigger_once
__________________
"Podra parecer ridiculo o imposible, pero este es el camino que seguimos los verdaderos hombres, si hay un muro en el camino, lo derribamos, si no hay camino, haremos uno, con nuestras propias manos, porque el magma de nuestro corazón arde en llamas."

Last edited by YakumoHiratsuhi; 01-31-2013 at 17:09.
YakumoHiratsuhi is offline
Send a message via MSN to YakumoHiratsuhi
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:29.


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