Hey guys,
I have managed to hook entities so that they call back:
PHP Code:
HookEntities()
{
new dungbell = EntRefToEntIndex(FindEnt("logic_relay", "dungbellxp"))
HookSingleEntityOutput(dungbell, "OnTrigger", DungBell)
new jump = EntRefToEntIndex(FindEnt("logic_relay", "jumpxp"))
HookSingleEntityOutput(jump, "OnTrigger", Jump)
//new escape = FindEnt("logic_relay", "escapexp")
//HookSingleEntityOutput(escape, "Trigger", Escape)
new running1 = EntRefToEntIndex(FindEnt("logic_relay", "runninghalf"))
HookSingleEntityOutput(running1, "OnTrigger", Running1)
new running2 = EntRefToEntIndex(FindEnt("logic_relay", "runningfull"))
HookSingleEntityOutput(running2, "OnTrigger", Running2)
new pool1 = EntRefToEntIndex(FindEnt("logic_relay", "poolhalf"))
HookSingleEntityOutput(pool1, "OnTrigger", Pool1)
new pool2 = EntRefToEntIndex(FindEnt("logic_relay", "poolfull"))
HookSingleEntityOutput(pool2, "OnTrigger", Pool2)
new poolcancel = EntRefToEntIndex(FindEnt("logic_relay", "poolcancel"))
HookSingleEntityOutput(poolcancel, "OnTrigger", PoolCancel)
new kick = EntRefToEntIndex(FindEnt("logic_relay", "kick"))
HookSingleEntityOutput(kick, "OnTrigger", Kick)
new metaldetector = EntRefToEntIndex(FindEnt("logic_relay", "metaldetector_check"))
HookSingleEntityOutput(metaldetector, "OnTrigger", MetalDetector)
}
However, as soon as someone joins the server, all the hooks stop working. Im assuming that the new player offsets the entities, however I was under the impression that the server kept a buffer of MAX_PLAYERS before other entities started in order to cater for that.. is this different with logic entities?
Or perhaps this is just an issue with the HookSingleEntityOutput function?
Does anyone know a way to fix this? For now, I will just hack and unhook all the previous entities and rehook them again using the EntRefs.
Thanks.