Created
November 10, 2017 03:52
-
-
Save anonymous/2c59fe42d6e7f1de92b266069b6c4745 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sdkhooks> | |
#pragma semicolon 1 | |
#pragma newdecls required | |
public Plugin myinfo = { | |
name = "Fizzle Stickybombs", | |
author = "http://teamfortress.tv/user/epi", | |
description = "Fizzle stickybombs after a delay.", | |
version = "0.1", | |
url = "http://domain.invalid/" | |
}; | |
#define STICKY_CLASSNAME "tf_projectile_pipe_remote" | |
ConVar delay; | |
ConVar enabled; | |
Action destroy_sticky(Handle timer, any sticky) { | |
char classname[26]; | |
if ( | |
!enabled.BoolValue || | |
!IsValidEdict(sticky) || | |
!GetEdictClassname(sticky, classname, 26) || | |
!StrEqual(classname, STICKY_CLASSNAME) | |
) { | |
return Plugin_Stop; | |
} | |
RemoveEdict(sticky); | |
return Plugin_Handled; | |
} | |
public void OnPluginStart() { | |
delay = CreateConVar( | |
"sm_fizzle_stickies_delay", | |
"5.0", | |
"Number of seconds before fizzling stickies", | |
0, | |
true, | |
0.1 | |
); | |
enabled = CreateConVar( | |
"sm_fizzle_stickies_enabled", | |
"1", | |
"Fizzle stickies after a delay if enabled.", | |
0 | |
); | |
} | |
public void OnEntityCreated(int entity, const char[] classname) { | |
if ( | |
!enabled.BoolValue || | |
!IsValidEdict(entity) || | |
!StrEqual(classname, STICKY_CLASSNAME) | |
) { | |
return; | |
} | |
Handle timer = CreateTimer( | |
delay.FloatValue, | |
destroy_sticky, | |
entity, | |
0 | |
); | |
if (timer == INVALID_HANDLE) { | |
PrintToServer("Couldn't create timer to destroy sticky"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment