updating a bunch of stupid things
This commit is contained in:
parent
caf674479c
commit
c68128200a
@ -81,6 +81,9 @@ bool g_bClientProtection[g_dIndexes];
|
||||
|
||||
Handle g_hClientZMCookie;
|
||||
Handle g_hClientHumanCookie;
|
||||
Handle g_hCheckBotStuck = null;
|
||||
Handle g_hZombieSounds = null;
|
||||
Handle g_hFixKNife = null;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -143,6 +146,10 @@ public void OnPluginStart()
|
||||
RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN);
|
||||
RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN);
|
||||
|
||||
g_hCheckBotStuck = CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hZombieSounds = CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
g_hFixKNife = CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT);
|
||||
|
||||
for (int i = 1; i < MaxClients; i++)
|
||||
{
|
||||
if (IsValidClient(i))
|
||||
@ -152,6 +159,16 @@ public void OnPluginStart()
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPluginEnd()
|
||||
{
|
||||
if (g_hCheckBotStuck != null)
|
||||
delete g_hCheckBotStuck;
|
||||
if (g_hZombieSounds != null)
|
||||
delete g_hZombieSounds;
|
||||
if (g_hFixKNife != null)
|
||||
delete g_hFixKNife;
|
||||
}
|
||||
|
||||
public Action CheckPlayerTeam(Handle timer, any userid)
|
||||
{
|
||||
int client = GetClientOfUserId(userid);
|
||||
@ -352,8 +369,10 @@ public Action Cmd_Say(int client, int args)
|
||||
getclientteam might be checked unnecesarily this way because its also checking in ZmarketGetWeapon
|
||||
but this way most can be stopped to interferre from triggering cmd_say
|
||||
*/
|
||||
if (client < 1)
|
||||
if (!IsValidClient(client))
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
if (GetClientTeam(client) != CS_TEAM_CT || !IsPlayerAlive(client))
|
||||
return Plugin_Continue;
|
||||
@ -833,6 +852,7 @@ public void loadWeapons()
|
||||
{
|
||||
CreateBackUpWeapons();
|
||||
}
|
||||
g_iWeaponIndex = 0; //ofc this has to be reset, otherwise it ends up going out of bounds dx
|
||||
kv.ImportFromFile(g_cPathsWeapons);
|
||||
kv.GotoFirstSubKey();
|
||||
kv.GetString("weaponentity", g_cWeaponEntity[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponEntity));
|
||||
@ -885,6 +905,8 @@ public Action LoadClasses()
|
||||
delete l_hFileZM;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
//first indexes go to human classes, all afterfollowing to zms
|
||||
while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine)))
|
||||
{
|
||||
@ -911,9 +933,6 @@ public void OnMapStart()
|
||||
LoadClasses();
|
||||
LoadExtraSettings();
|
||||
loadWeapons();
|
||||
CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT);
|
||||
}
|
||||
|
||||
//just checking the knife when they spawn is appereantly not good enough. this is just repeating what Timer_StopProtection does.
|
||||
@ -923,6 +942,15 @@ public Action Timer_FixKNife(Handle timer, any userid)
|
||||
{
|
||||
if (IsValidClient(client) && IsPlayerAlive(client))
|
||||
{
|
||||
//the fucking forwards wont give the bots the client tags. it should obviously work. cause it works on ze.
|
||||
//too bad!
|
||||
if (IsFakeClient(client))
|
||||
{
|
||||
char tag[64];
|
||||
Format(tag, sizeof(tag), "UNLOZE ");
|
||||
CS_SetClientClanTag(client, tag);
|
||||
}
|
||||
|
||||
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
|
||||
{
|
||||
GivePlayerItem(client, "weapon_knife");
|
||||
@ -1042,6 +1070,12 @@ public Action RetrieveWaveSettings(int wave)
|
||||
delete l_hWave;
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char hostname[512];
|
||||
Format(hostname, sizeof(hostname), "UNLOZE | FASTDL | Ranking | Day %i: %s", wave, g_cDaysTitles[wave - 1]);
|
||||
ServerCommand("hostname \"%s\"", hostname);
|
||||
|
||||
|
||||
PrintToChatAll("Day %i: %s", wave, g_cDaysTitles[wave - 1]);
|
||||
LoadWave(wave);
|
||||
delete l_hWave;
|
||||
@ -1846,8 +1880,24 @@ public Action UpdateWaveCount(int client)
|
||||
}
|
||||
else if (GetClientTeam(client) == CS_TEAM_T)
|
||||
{
|
||||
int zombieCount = 0;
|
||||
int humanCount = 0;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (GetClientTeam(i) == CS_TEAM_CT)
|
||||
{
|
||||
humanCount++;
|
||||
}
|
||||
else if (GetClientTeam(i) == CS_TEAM_T)
|
||||
{
|
||||
zombieCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_iZMCount--;
|
||||
PrintHintTextToAll("Day %i: %s\nRemaining Zombies: %i", g_iWave, g_cDaysTitles[g_iWave - 1], g_iZMCount);
|
||||
PrintHintTextToAll("Day %i: %s\nRemaining Zombies: %i\nHumans: %i\nZombies: %i", g_iWave, g_cDaysTitles[g_iWave - 1], g_iZMCount, humanCount, zombieCount);
|
||||
}
|
||||
if (g_iZMCount == 0 && g_bRoundInProgress)
|
||||
{
|
||||
@ -1855,6 +1905,19 @@ public Action UpdateWaveCount(int client)
|
||||
CS_TerminateRound(4.0, CSRoundEnd_CTWin, true);
|
||||
g_iWave++;
|
||||
g_bRoundInProgress = false;
|
||||
|
||||
|
||||
if (g_iWave > 90)
|
||||
{
|
||||
PrintToChatAll("debug: Reseting to Wave 1.");
|
||||
g_iWave = 1;
|
||||
}
|
||||
/* i dont fucking know how g_iWave got out of bounds...
|
||||
L 01/31/2024 - 10:53:07: [SM] Exception reported: Array index out-of-bounds (index 111, limit 100)
|
||||
L 01/31/2024 - 10:53:07: [SM] Blaming: unloze_zr.smx
|
||||
L 01/31/2024 - 10:53:07: [SM] Call stack trace:
|
||||
L 01/31/2024 - 10:53:07: [SM] [1] Line 1040, unloze_zr.sp::RetrieveWaveSettings
|
||||
*/
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user