CloseHandle -> delete
This commit is contained in:
+32
-56
@@ -5,22 +5,22 @@ public void OnMapStart()
|
||||
|
||||
AddFileToDownloadsTable("sound/unl1/disco.wav");
|
||||
PrecacheSound("unl1/disco.wav");
|
||||
|
||||
|
||||
AddFileToDownloadsTable("sound/unl1/steamedyes.mp3");
|
||||
PrecacheSound("unl1/steamedyes.mp3");
|
||||
|
||||
|
||||
GetCurrentMap(g_sMapName, sizeof(g_sMapName));
|
||||
LowerString(g_sMapName, sizeof(g_sMapName));
|
||||
|
||||
RestartTimers();
|
||||
ClearMapInfo();
|
||||
CheckDirectories();
|
||||
|
||||
|
||||
if (g_hDatabase != null)
|
||||
{
|
||||
LoadMapInfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OnConfigsExecuted()
|
||||
@@ -57,7 +57,7 @@ public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast)
|
||||
{
|
||||
CreateTrigger(i);
|
||||
}
|
||||
for (int i = 0; i <= MAXPLAYERS; i++)
|
||||
for (int i = 0; i <= MAXPLAYERS; i++)
|
||||
{
|
||||
g_iActivity[i] = -1;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast)
|
||||
|
||||
/*public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
|
||||
{
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
public void Event_PlayerDeath(Handle event, char[] name, bool dontBroadcast)
|
||||
@@ -78,12 +78,12 @@ void CheckDirectories()
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, path, sizeof(path), REPLAYS_PATH);
|
||||
|
||||
|
||||
if (!DirExists(path))
|
||||
CreateDirectory(path, 711);
|
||||
|
||||
|
||||
BuildPath(Path_SM, path, sizeof(path), "%s/%s", REPLAYS_PATH, g_sMapName);
|
||||
|
||||
|
||||
if (!DirExists(path))
|
||||
CreateDirectory(path, 711);
|
||||
|
||||
@@ -91,39 +91,15 @@ void CheckDirectories()
|
||||
|
||||
public void RestartTimers()
|
||||
{
|
||||
|
||||
if (g_hDrawFullZone != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(g_hDrawFullZone);
|
||||
g_hDrawFullZone = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (g_hDrawZone != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(g_hDrawZone);
|
||||
g_hDrawZone = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (g_hHudLoop != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(g_hHudLoop);
|
||||
g_hHudLoop = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (g_hSideHudLoop != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(g_hSideHudLoop);
|
||||
g_hSideHudLoop = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (g_hDrawFullZone == INVALID_HANDLE)
|
||||
g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
if (g_hDrawZone == INVALID_HANDLE)
|
||||
g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
if (g_hHudLoop == INVALID_HANDLE)
|
||||
g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
if (g_hSideHudLoop == INVALID_HANDLE)
|
||||
g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
delete g_hDrawFullZone;
|
||||
delete g_hDrawZone;
|
||||
delete g_hHudLoop;
|
||||
delete g_hSideHudLoop;
|
||||
|
||||
g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
public void ClearMapInfo()
|
||||
@@ -144,7 +120,7 @@ public void ClearMapInfo()
|
||||
g_bEditorComesFromMenu = false;
|
||||
g_iSnapToClient = -1;
|
||||
g_fWrTime = -1.0;
|
||||
|
||||
|
||||
Format(g_sWrHolder, sizeof(g_sWrHolder), "\0");
|
||||
}
|
||||
|
||||
@@ -160,39 +136,39 @@ public void ProcessFinish(int client)
|
||||
|
||||
if (fTimeToWR == fTime)
|
||||
Format(cTimeToWR, sizeof(cTimeToWR), "WR");
|
||||
|
||||
|
||||
else
|
||||
TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true);
|
||||
|
||||
|
||||
if (g_fMapTime[client] > fTime)
|
||||
{
|
||||
float fTimeDif;
|
||||
char cTimeDif[16];
|
||||
|
||||
|
||||
fTimeDif = g_fMapTime[client] - fTime;
|
||||
g_fMapTime[client] = fTime;
|
||||
TimerFormat(fTimeDif, cTimeDif, sizeof(cTimeDif), true, false);
|
||||
|
||||
|
||||
TimerPrintToChat(client, true, "%T", "FinishedImproved", LANG_SERVER, name, cTime, cTimeToWR, cTimeDif);
|
||||
UpdateTime(client);
|
||||
|
||||
|
||||
if (fTimeToWR < 0.0)
|
||||
UpdateWR(client, fTime, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
TimerPrintToChat(client, true, "%T", "Finished", LANG_SERVER, name, cTime, cTimeToWR);
|
||||
|
||||
|
||||
if (g_fMapTime[client] == 0.0)
|
||||
{
|
||||
g_fMapTime[client] = fTime;
|
||||
|
||||
|
||||
UpdateTime(client);
|
||||
if (fTimeToWR < 0.0 || g_fWrTime == 0.0)
|
||||
{
|
||||
UpdateWR(client, fTime, name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -208,17 +184,17 @@ public void UpdateWR(int client, float time, char[] name)
|
||||
LogError("WR never loaded, reload map");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (g_fWrTime < time && g_fWrTime != 0.0)
|
||||
{
|
||||
LogError("Time submitted is not faster");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SaveRecord(client);
|
||||
|
||||
g_fWrTime = time;
|
||||
|
||||
|
||||
strcopy(g_sWrHolder, sizeof(g_sWrHolder), name);
|
||||
}
|
||||
|
||||
@@ -228,13 +204,13 @@ public void ProcessRankMessage(int client, int rank, int total)
|
||||
GetClientName(client, name, sizeof(name));
|
||||
if (rank > 10)
|
||||
TimerPrintToChat(client, false, "%T", "Rank", LANG_SERVER, name, rank, total);
|
||||
|
||||
|
||||
else if (rank <= 10 && rank != 1)
|
||||
{
|
||||
TimerPrintToChat(client, true, "%T", "RankTop10", LANG_SERVER, name, rank, total);
|
||||
EmitSoundToAll("unl1/steamedyes.mp3");
|
||||
}
|
||||
|
||||
|
||||
else if (rank == 1)
|
||||
{
|
||||
TimerPrintToChat(client, true, "%T", "RankWR", LANG_SERVER, name, rank, total);
|
||||
|
||||
Reference in New Issue
Block a user