VScripts: Clean code slightly, and remove 'version' check.

This commit is contained in:
zaCade 2018-12-08 17:46:50 +01:00
parent 74560d9797
commit 013ff290ee

View File

@ -1,26 +1,10 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <multicolors>
#pragma semicolon 1
#pragma newdecls required
#define MAXTIMERS 128
/* STRINGS */
/* CONVARS */
/* HANDLES */
Handle g_hTimers[MAXTIMERS] = {INVALID_HANDLE, ...};
/* BOOLS */
/* INTEGERS */
int g_iTimerCount = 0;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -54,12 +38,14 @@ public void OnMapStart()
//----------------------------------------------------------------------------------------------------
public void VerifyMap()
{
char currentMap[64];
GetCurrentMap(currentMap, sizeof(currentMap));
if (strcmp(currentMap, "ze_dreamin_v2_1s_fix3", false) != 0)
char sCurrentMap[64];
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
if (strncmp(sCurrentMap, "ze_dreamin_", 11, false) != 0)
{
char sFilename[256];
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
ServerCommand("sm plugins unload %s", sFilename);
}
}
@ -69,15 +55,6 @@ public void VerifyMap()
//----------------------------------------------------------------------------------------------------
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
for (int i = 0; i <= (MAXTIMERS - 1); i++)
{
if (g_hTimers[i] != INVALID_HANDLE && CloseHandle(g_hTimers[i]))
g_hTimers[i] = INVALID_HANDLE;
}
g_iTimerCount = 0;
int iEntity = INVALID_ENT_REFERENCE;
iEntity = FindEntityByTargetName("reflect_logic");
@ -629,13 +606,14 @@ public void Display(int amount)
for (int j = 0; j <= amount; j++)
{
iBackup --;
iBackup--;
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message %d,%d,-1", iBackup, j);
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,Display,,%d,-1",j);
DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,Display,,%d,-1",j);
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,Display,,%d,-1",j);
}
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message ,%d,-1",amount + 1);
DispatchKeyFormat(iRelay, "OnTrigger", "seconds_left,AddOutput,message ,%d,-1",amount + 1);
DispatchKeyFormat(iRelay, "OnTrigger", "text_sec,AddOutput,message ,%d,-1",amount + 1);
DispatchKeyFormat(iRelay, "OnTrigger", "!self,Kill,,%d,-1",amount + 2);
SpawnAndActivate(iRelay);
@ -658,6 +636,7 @@ public int FindEntityByTargetName(const char[] sTargetnameToFind)
return iEntity;
}
}
PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind);
return INVALID_ENT_REFERENCE;
}
@ -675,6 +654,7 @@ public int FindEntityByHammerID(int iHammerID)
return iEntity;
}
}
PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID);
return INVALID_ENT_REFERENCE;
}