Skip to content

Commit

Permalink
Closing all handles
Browse files Browse the repository at this point in the history
Remove EngineVersion variable as global
  • Loading branch information
Bara authored Aug 23, 2020
1 parent 67abc1f commit 62d19c4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions addons/sourcemod/scripting/SurfTimer-telefinder.sp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
#include <cstrike>
#include <surftimer>

EngineVersion g_Game;


Handle g_hEntity;
Handle g_hTMEntity;

Expand All @@ -22,8 +19,8 @@ public Plugin myinfo =

public void OnPluginStart()
{
g_Game = GetEngineVersion();
if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
EngineVersion eGame = GetEngineVersion();
if(eGame != Engine_CSGO && eGame != Engine_CSS)
{
SetFailState("[Surf Timer][TDF] This plugin is for CSGO/CSS only.");
}
Expand Down Expand Up @@ -57,11 +54,8 @@ public void OnMapStart()

public void OnMapEnd()
{
if (g_hEntity != null)
g_hEntity.Close();

g_hEntity = null;
delete g_hEntity;
delete g_hTMEntity;
}


Expand Down Expand Up @@ -100,6 +94,8 @@ public int TD_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position);

surftimer_SafeTeleport(param1, position, NULL_VECTOR, NULL_VECTOR, true);
} else if (action == MenuAction_End) {
delete menu;
}
}

Expand Down Expand Up @@ -136,5 +132,7 @@ public int TM_MenuHandler(Menu menu, MenuAction action, int param1, int param2)
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", position);

surftimer_SafeTeleport(param1, position, NULL_VECTOR, NULL_VECTOR, true);
} else if (action == MenuAction_End) {
delete menu;
}
}

0 comments on commit 62d19c4

Please sign in to comment.