fixed random knife swtiching for humans, reduced timer for respawning zombies and fixed mapchange when last day is beaten

This commit is contained in:
jenz 2024-02-13 21:47:51 +01:00
parent 4a5c556e66
commit d3b1a59885

View File

@ -291,7 +291,7 @@ public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
}
else if (IsFakeClient(client)) //bot getting respawned as zm
{
CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(client));
CreateTimer(0.3, Timer_delayedSelectWaveBasedZM, GetClientUserId(client));
}
else
{
@ -996,6 +996,8 @@ public Action Timer_FixKNife(Handle timer, any userid)
CS_SetClientClanTag(client, tag);
}
if (GetClientTeam(client) == CS_TEAM_T)
{
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
{
GivePlayerItem(client, "weapon_knife");
@ -1003,6 +1005,7 @@ public Action Timer_FixKNife(Handle timer, any userid)
}
}
}
}
return Plugin_Handled;
}
@ -1093,7 +1096,7 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
{
if (IsFakeClient(i))
{
CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(i));
CreateTimer(0.3, Timer_delayedSelectWaveBasedZM, GetClientUserId(i));
continue;
}
g_iClientRespawnCount[i] = g_iClientRespawnCountNum; //even if not spawned in yet it should be set for every real player.
@ -1327,6 +1330,7 @@ public void LoadWave(int wave)
g_iWave = 1;
PrintToChatAll("Finished last Day! Forcing map change...");
ServerCommand("sm_forcertv"); //old zombieRiot did this so just copying it
CS_TerminateRound(4.0, CSRoundEnd_CTWin, true); //without this it wont change map i guess? or at least without it they get a wave without settings set.
}
delete kv;
delete kv1;
@ -1490,7 +1494,7 @@ public Action SelectWaveBasedZM(int client, int state)
if (GetClientTeam(client) == CS_TEAM_CT)
{
ChangeClientTeam(client, CS_TEAM_T); //default putting bots to t
CreateTimer(1.0, Timer_delayedRespawn, GetClientUserId(client));
CreateTimer(0.3, Timer_delayedRespawn, GetClientUserId(client));
return Plugin_Handled;
}
//state 0 was bot, state 1 was real player.
@ -1538,7 +1542,7 @@ public Action SelectWaveBasedZM(int client, int state)
}
//im just getting desperate at this point for fixing the client crash by adding random ass delays.
CreateTimer(1.0, Timer_delayedModelSelection, GetClientUserId(client));
CreateTimer(0.3, Timer_delayedModelSelection, GetClientUserId(client));
return Plugin_Handled;
}
@ -1748,13 +1752,19 @@ public Action Timer_StopProtection(Handle timer, any userid)
if (IsValidClient(client) && IsPlayerAlive(client))
{
g_bClientProtection[client] = false;
if (GetClientTeam(client) == CS_TEAM_T)
{
Client_ChangeWeapon(client, "weapon_knife");
}
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
{
GivePlayerItem(client, "weapon_knife");
if (GetClientTeam(client) == CS_TEAM_T)
{
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client));
}
}
}
return Plugin_Handled;
}