View Full Version : [TF2] Hooking code on flag picked up
Michalplyoutube
10-18-2014, 13:14
I Did checked sdkhooks and wasn't there an ideal hook OnFlagStartTouch Fires multiple times
is there a way around it to make it fire once per event like on flag pick up?
psychonic
10-18-2014, 13:26
Hook the teamplay_flag_event event.
https://wiki.alliedmods.net/Team_Fortress_2_Events#teamplay_flag_event
The eventtype field will be 1 for flag pickup.
Powerlord
10-18-2014, 13:53
Hook the teamplay_flag_event event.
https://wiki.alliedmods.net/Team_Fortress_2_Events#teamplay_flag_event
The eventtype field will be 1 for flag pickup.
I'm going to note we have an enum for that in tf2_stocks. Appropriate value from it is TF_FLAGEVENT_PICKEDUP
Michalplyoutube
10-18-2014, 13:58
removed
Michalplyoutube
10-18-2014, 14:30
Can't get it working
HookEvent( "teamplay_flag_event", TF_FLAGEVENT_PICKEDUP );
Can i see an example please?
rswallen
10-18-2014, 14:58
public OnPluginsStart()
{
HookEvent("teamplay_flag_event", EventHook_FlagStuff);
return;
}
public EventHook_FlagStuff(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetEventInt(event, "eventtype") == TF_FLAGEVENT_PICKEDUP)
{
// a flag was picked up
}
return;
}
Michalplyoutube
10-18-2014, 15:00
public OnPluginsStart()
{
HookEvent("teamplay_flag_event", EventHook_FlagStuff);
return;
}
public EventHook_FlagStuff(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetEventInt(event, "eventtype") == TF_FLAGEVENT_PICKEDUP)
{
// a flag was picked up
}
return;
}
OH gawd thank you
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.