Maybe I am just going crazy, but when I test these I get things flipped backwards as to what they should be.
PHP Code:
new Teleporter_Entry[MAXPLAYERS + 1] = {-1, ...};
new Teleporter_Exit[MAXPLAYERS + 1] = {-1, ...};
public OnPluginStart()
{
HookEvent("player_builtobject", Event_Player_BuiltObject_Post);
}
public Event_Player_BuiltObject_Post(Handle:event, const String:name[], bool:dontBroadcast)
{
new entity = GetEventInt(event, "index");
new type = GetEntProp(entity, Prop_Send, "m_iObjectType");
new builder = GetEntPropEnt(entity, Prop_Send, "m_hBuilder");
if (IsValidClient(builder))
{
if (type == any:TFObject_Teleporter)
{
if (GetEntProp(entity, Prop_Data, "m_iTeleportType") == any:TFObjectMode_Exit)
{
Teleporter_Exit[builder] = entity;
PrintToChat(builder, "Exit!?");
}
else if (GetEntProp(entity, Prop_Data, "m_iTeleportType") == any:TFObjectMode_Entrance)
{
Teleporter_Entry[builder] = entity;
}
}
}
}
A quick test using this code makes it say "Exit!?" whenever I build an entrance.