Skip to content

Commit 8387a94

Browse files
authored
Fix some code runs when plugin is disabled. (#120)
1 parent a3ae9ac commit 8387a94

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

scripting/randomizer.sp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#pragma newdecls required
1717

18-
#define PLUGIN_VERSION "1.11.0"
18+
#define PLUGIN_VERSION "1.11.1"
1919
#define PLUGIN_VERSION_REVISION "manual"
2020

2121
#define CONFIG_MAXCHAR 64
@@ -511,6 +511,9 @@ public void OnLibraryRemoved(const char[] sName)
511511

512512
public void OnGameFrame()
513513
{
514+
if (!g_bEnabled)
515+
return;
516+
514517
bool bWeaponCreated;
515518

516519
for (int iClient = 1; iClient <= MaxClients; iClient++)
@@ -829,13 +832,19 @@ bool CanEquipIndex(int iClient, int iIndex)
829832

830833
public Action Console_EurekaTeleport(int iClient, const char[] sCommand, int iArgs)
831834
{
835+
if (!g_bEnabled)
836+
return Plugin_Continue;
837+
832838
g_iClientEurekaTeleporting = iClient;
833839
SetClientClass(iClient, TFClass_Engineer);
834840
return Plugin_Continue;
835841
}
836842

837843
public Action Console_DropItem(int iClient, const char[] sCommand, int iArgs)
838844
{
845+
if (!g_bEnabled)
846+
return Plugin_Continue;
847+
839848
static bool bSkip;
840849
if (bSkip)
841850
return Plugin_Continue;

scripting/randomizer/event.sp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public void Event_RoundStart(Event event, const char[] sName, bool bDontBroadcas
2626

2727
public void Event_PointCaptured(Event hEvent, const char[] sName, bool bDontBroadcast)
2828
{
29+
if (!g_bEnabled)
30+
return;
31+
2932
char[] sCappers = new char[MaxClients];
3033

3134
hEvent.GetString("cappers", sCappers, MaxClients+1);
@@ -37,6 +40,9 @@ public void Event_PointCaptured(Event hEvent, const char[] sName, bool bDontBroa
3740

3841
public void Event_FlagCaptured(Event hEvent, const char[] sName, bool bDontBroadcast)
3942
{
43+
if (!g_bEnabled)
44+
return;
45+
4046
if (hEvent.GetInt("eventtype") != 2) //Check if it actually capture and not other events
4147
return;
4248

@@ -193,6 +199,9 @@ public void Event_PassScore(Event event, const char[] sName, bool bDontBroadcast
193199

194200
public void Event_WeaponJump(Event event, const char[] sName, bool bDontBroadcast)
195201
{
202+
if (!g_bEnabled)
203+
return;
204+
196205
//Class check should be done by this point, revert class so pain sound can be played as actual class
197206
if (g_bOnTakeDamage)
198207
{

0 commit comments

Comments
 (0)