AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get func_door entity id handled by func_button (https://forums.alliedmods.net/showthread.php?t=207235)

YakumoHiratsuhi 01-31-2013 11:32

get func_door entity id handled by func_button
 
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)
        }
    }



jimaway 01-31-2013 11:59

Re: get func_door entity id handled by func_button
 
pev(targetent, pev_classname, charsmax(classname))
->
pev(targetent, pev_classname, classname, charsmax(classname))

YakumoHiratsuhi 01-31-2013 16:55

Re: get func_door entity id handled by func_button
 
Thanks so much, its working now, btw you know which entities have the pev_target field assigned? just to handle much more maps :P
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


All times are GMT -4. The time now is 20:29.

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