Raised This Month: $ Target: $400
 0% 

[TF2] Hooking code on flag picked up


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 10-18-2014 , 13:14   [TF2] Hooking code on flag picked up
Reply With Quote #1

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?
Michalplyoutube is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-18-2014 , 13:26   Re: [TF2] Hooking code on flag picked up
Reply With Quote #2

Hook the teamplay_flag_event event.
https://wiki.alliedmods.net/Team_For...lay_flag_event

The eventtype field will be 1 for flag pickup.
psychonic is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-18-2014 , 13:53   Re: [TF2] Hooking code on flag picked up
Reply With Quote #3

Quote:
Originally Posted by psychonic View Post
Hook the teamplay_flag_event event.
https://wiki.alliedmods.net/Team_For...lay_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
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-18-2014 at 13:53. Reason: Chrome seems to think "Appopiate" is a word in the text box but not the reason for editing box. Thanks Chrome!
Powerlord is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 10-18-2014 , 13:58   Re: [TF2] Hooking code on flag picked up
Reply With Quote #4

removed

Last edited by Michalplyoutube; 10-18-2014 at 14:29.
Michalplyoutube is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 10-18-2014 , 14:30   Re: [TF2] Hooking code on flag picked up
Reply With Quote #5

Can't get it working
HookEvent( "teamplay_flag_event", TF_FLAGEVENT_PICKEDUP );
Can i see an example please?
Michalplyoutube is offline
rswallen
SourceMod Donor
Join Date: Jun 2013
Location: 127.0.0.1
Old 10-18-2014 , 14:58   Re: [TF2] Hooking code on flag picked up
Reply With Quote #6

PHP Code:
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;

__________________
rswallen is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 10-18-2014 , 15:00   Re: [TF2] Hooking code on flag picked up
Reply With Quote #7

Quote:
Originally Posted by rswallen View Post
PHP Code:
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
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube 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 22:23.


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