Raised This Month: $32 Target: $400
 8% 

TFObjectMode Enumeration incorrect?!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 02-25-2016 , 18:44   TFObjectMode Enumeration incorrect?!
Reply With Quote #1

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(entityProp_Send"m_iObjectType");
    new 
builder GetEntPropEnt(entityProp_Send"m_hBuilder");
    if (
IsValidClient(builder))
    {
        if (
type == any:TFObject_Teleporter)
        {
            if (
GetEntProp(entityProp_Data"m_iTeleportType") == any:TFObjectMode_Exit)
            {
                
Teleporter_Exit[builder] = entity;
                
PrintToChat(builder"Exit!?");
            }
            else if (
GetEntProp(entityProp_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.
CoolJosh3k is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2016 , 09:34   Re: TFObjectMode Enumeration incorrect?!
Reply With Quote #2

Did you check m_iObjectMode to see if the values matched there?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 02-27-2016 , 01:42   Re: TFObjectMode Enumeration incorrect?!
Reply With Quote #3

Hmm, interesting. "m_iTeleportType" gives a 1 and a 2. "m_iObjectMode" gives a 0 and a 1.
Looks like using "m_iTeleportType" is a trap.

Now I just need to find out how to check if a building is active, but I already have another ticket for that open already here: https://forums.alliedmods.net/showthread.php?p=2396916
CoolJosh3k is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-27-2016 , 07:18   Re: TFObjectMode Enumeration incorrect?!
Reply With Quote #4

Those enums are for use with TF2_GetObjectType and TF2_GetObjectMode.
__________________
asherkin is offline
Reply



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 12:01.


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