Raised This Month: $ Target: $400
 0% 

Solved [TF2]how to check teleporter is exit or entrance ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kamil445
Member
Join Date: Dec 2013
Old 12-16-2016 , 12:07   [TF2]how to check teleporter is exit or entrance ?
Reply With Quote #1

Hi, how to check this ?


My code doesnt work:

PHP Code:
new objekt GetEventInt(event"object")
new 
index GetEventInt(event"index");
new 
String:classname[45];
GetEdictClassname(indexclassnamesizeof(classname));

if(
StrEqual(classname"obj_teleporter_entrance"))
{
//code here
} else if(StrEqual(classname"obj_teleporter_exit"))
{
//code here


Last edited by Kamil445; 12-16-2016 at 13:41.
Kamil445 is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 12-16-2016 , 13:02   Re: [TF2]how to check teleporter is exit or entrance ?
Reply With Quote #2

Well your code doesn't work because entity class name "obj_teleporter_entrance" and "obj_teleporter_exit" does not exist. I don't know where you got those, but that's wrong.

You have to use TF2_GetObjectMode with the TFObjectMode enum to know if a teleporter is an exit or entrance teleporter.
Code:
public void OnPluginStart() {     HookEvent("player_builtobject", Event_Player_BuiltObject); } public Action Event_Player_BuiltObject(Event event, const char[] sEventName, bool bDontBroadCast) {     int iTeleporter = event.GetInt("index");         if (iTeleporter > MaxClients)     {         if (TF2_GetObjectMode(iTeleporter) == TFObjectMode_Entrance)         {             //your code goes here         }     } }

I also moved your code to new syntax, and I encourage you using it, since in the near future, support for it will be dropped, or well some sourcemod functions will only be available through methodmaps.
__________________

Last edited by Benoist3012; 12-16-2016 at 13:05.
Benoist3012 is offline
Kamil445
Member
Join Date: Dec 2013
Old 12-16-2016 , 13:41   Re: [TF2]how to check teleporter is exit or entrance ?
Reply With Quote #3

Thank you,

Working good
Kamil445 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 07:45.


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