VScripts: Clean code slightly, and remove 'version' check.
This commit is contained in:
parent
74560d9797
commit
013ff290ee
@ -1,26 +1,10 @@
|
|||||||
#pragma semicolon 1
|
|
||||||
|
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
|
|
||||||
|
#pragma semicolon 1
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
#define MAXTIMERS 128
|
|
||||||
|
|
||||||
/* STRINGS */
|
|
||||||
|
|
||||||
/* CONVARS */
|
|
||||||
|
|
||||||
/* HANDLES */
|
|
||||||
Handle g_hTimers[MAXTIMERS] = {INVALID_HANDLE, ...};
|
|
||||||
|
|
||||||
/* BOOLS */
|
|
||||||
|
|
||||||
/* INTEGERS */
|
|
||||||
int g_iTimerCount = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -54,12 +38,14 @@ public void OnMapStart()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void VerifyMap()
|
public void VerifyMap()
|
||||||
{
|
{
|
||||||
char currentMap[64];
|
char sCurrentMap[64];
|
||||||
GetCurrentMap(currentMap, sizeof(currentMap));
|
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
|
||||||
if (strcmp(currentMap, "ze_dreamin_v2_1s_fix3", false) != 0)
|
|
||||||
|
if (strncmp(sCurrentMap, "ze_dreamin_", 11, false) != 0)
|
||||||
{
|
{
|
||||||
char sFilename[256];
|
char sFilename[256];
|
||||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
||||||
|
|
||||||
ServerCommand("sm plugins unload %s", sFilename);
|
ServerCommand("sm plugins unload %s", sFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,15 +55,6 @@ public void VerifyMap()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
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;
|
int iEntity = INVALID_ENT_REFERENCE;
|
||||||
|
|
||||||
iEntity = FindEntityByTargetName("reflect_logic");
|
iEntity = FindEntityByTargetName("reflect_logic");
|
||||||
@ -629,13 +606,14 @@ public void Display(int amount)
|
|||||||
|
|
||||||
for (int j = 0; j <= amount; j++)
|
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,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", "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", "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);
|
DispatchKeyFormat(iRelay, "OnTrigger", "!self,Kill,,%d,-1",amount + 2);
|
||||||
|
|
||||||
SpawnAndActivate(iRelay);
|
SpawnAndActivate(iRelay);
|
||||||
@ -658,6 +636,7 @@ public int FindEntityByTargetName(const char[] sTargetnameToFind)
|
|||||||
return iEntity;
|
return iEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind);
|
PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind);
|
||||||
return INVALID_ENT_REFERENCE;
|
return INVALID_ENT_REFERENCE;
|
||||||
}
|
}
|
||||||
@ -675,6 +654,7 @@ public int FindEntityByHammerID(int iHammerID)
|
|||||||
return iEntity;
|
return iEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID);
|
PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID);
|
||||||
return INVALID_ENT_REFERENCE;
|
return INVALID_ENT_REFERENCE;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user