b9efc06bba
either not used at all or in disabled
219 lines
4.6 KiB
SourcePawn
219 lines
4.6 KiB
SourcePawn
public void OnMapStart()
|
|
{
|
|
PrecacheModel("models/error.mdl", true);
|
|
g_iBeam = PrecacheModel("materials/sprites/physbeam.vmt");
|
|
|
|
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()
|
|
{
|
|
g_bLasers = g_hCvarLasers.BoolValue;
|
|
}
|
|
|
|
public void OnLazorsChange(ConVar convar, char[] oldValue, char[] newValue)
|
|
{
|
|
g_bLasers = g_hCvarLasers.BoolValue;
|
|
}
|
|
|
|
public void OnClientPostAdminCheck(int client)
|
|
{
|
|
if (isValidClient(client))
|
|
{
|
|
ClearPlayerCache(client);
|
|
GetPlayerInfo(client);
|
|
}
|
|
}
|
|
|
|
public void OnClientDisconnect(int client)
|
|
{
|
|
if (client == g_iEditor)
|
|
{
|
|
g_iEditor = -1;
|
|
g_bEditorComesFromMenu = false;
|
|
}
|
|
}
|
|
|
|
public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast)
|
|
{
|
|
for (int i = 0; i <= 1; i++)
|
|
{
|
|
CreateTrigger(i);
|
|
}
|
|
for (int i = 0; i <= MAXPLAYERS; i++)
|
|
{
|
|
g_iActivity[i] = -1;
|
|
}
|
|
}
|
|
|
|
/*public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
|
|
{
|
|
|
|
}*/
|
|
|
|
public void Event_PlayerDeath(Handle event, char[] name, bool dontBroadcast)
|
|
{
|
|
int client = GetClientOfUserId(GetEventInt(event, "userid"));
|
|
g_iActivity[client] = -1;
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
public void RestartTimers()
|
|
{
|
|
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()
|
|
{
|
|
for (int i = 0; i <= 1; i++)
|
|
{
|
|
g_iTriggerEnt[i] = -1;
|
|
for (int f = 0; f <= 2; f++)
|
|
{
|
|
g_fStartOrigins[i][f] = 0.0;
|
|
g_fEndOrigins[i][f] = 0.0;
|
|
}
|
|
}
|
|
g_iTier = 1;
|
|
g_iMapID = -1;
|
|
g_bActive = false;
|
|
g_iEditor = -1;
|
|
g_bEditorComesFromMenu = false;
|
|
g_iSnapToClient = -1;
|
|
g_fWrTime = -1.0;
|
|
|
|
Format(g_sWrHolder, sizeof(g_sWrHolder), "\0");
|
|
}
|
|
|
|
public void ProcessFinish(int client)
|
|
{
|
|
float fTime, fTimeToWR;
|
|
char name[MAX_NAME_LENGTH], cTime[16], cTimeToWR[16];
|
|
|
|
GetClientName(client, name, sizeof(name));
|
|
fTime = GetEngineTime() - g_fStartTime[client];
|
|
fTimeToWR = fTime - g_fWrTime;
|
|
TimerFormat(fTime, cTime, sizeof(cTime), true, false);
|
|
|
|
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
|
|
{
|
|
AddCompletion(client);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void UpdateWR(int client, float time, char[] name)
|
|
{
|
|
if (g_fWrTime == -1.0)
|
|
{
|
|
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);
|
|
}
|
|
|
|
public void ProcessRankMessage(int client, int rank, int total)
|
|
{
|
|
char name[MAX_NAME_LENGTH];
|
|
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);
|
|
EmitSoundToAll("unl1/disco.wav");
|
|
}
|
|
} |