Raised This Month: $ Target: $400
 0% 

get func_door entity id handled by func_button


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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