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_NULLENT, target[32], classname[32], targetent = FM_NULLENT;
while (((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "func_button")) != 0))
{
// Not valid
if(!pev_valid(ent))
continue;
// Get target name
pev(ent, pev_target, target, charsmax(target))
// Search for doors
while (((targetent = engfunc(EngFunc_FindEntityByString, ent, "targetname", target)) != 0))
{
// Not valid
if(!pev_valid(targetent))
continue;
// Get target ent
pev(targetent, pev_classname, charsmax(classname))
console_print(0, "Entidad del boton %d con el identificador %d y clase %s", ent, targetent, classname)
// Not a door ._.
if(!equal(classname, "func_door") && !equal(classname, "func_door_rotating"))
continue;
// Use the button
dllfunc(DLLFunc_Use, ent, 0)
set_pev(ent, pev_frame, 0.0)
}
}
}
__________________