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 else if (IsFakeClient(client)) //bot getting respawned as zm
{ {
CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(client)); CreateTimer(0.3, Timer_delayedSelectWaveBasedZM, GetClientUserId(client));
} }
else else
{ {
@ -996,10 +996,13 @@ public Action Timer_FixKNife(Handle timer, any userid)
CS_SetClientClanTag(client, tag); CS_SetClientClanTag(client, tag);
} }
if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one if (GetClientTeam(client) == CS_TEAM_T)
{ {
GivePlayerItem(client, "weapon_knife"); if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client)); {
GivePlayerItem(client, "weapon_knife");
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client));
}
} }
} }
} }
@ -1093,7 +1096,7 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
{ {
if (IsFakeClient(i)) if (IsFakeClient(i))
{ {
CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(i)); CreateTimer(0.3, Timer_delayedSelectWaveBasedZM, GetClientUserId(i));
continue; continue;
} }
g_iClientRespawnCount[i] = g_iClientRespawnCountNum; //even if not spawned in yet it should be set for every real player. 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; g_iWave = 1;
PrintToChatAll("Finished last Day! Forcing map change..."); PrintToChatAll("Finished last Day! Forcing map change...");
ServerCommand("sm_forcertv"); //old zombieRiot did this so just copying it 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 kv;
delete kv1; delete kv1;
@ -1490,7 +1494,7 @@ public Action SelectWaveBasedZM(int client, int state)
if (GetClientTeam(client) == CS_TEAM_CT) if (GetClientTeam(client) == CS_TEAM_CT)
{ {
ChangeClientTeam(client, CS_TEAM_T); //default putting bots to t 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; return Plugin_Handled;
} }
//state 0 was bot, state 1 was real player. //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. //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; return Plugin_Handled;
} }
@ -1748,11 +1752,17 @@ public Action Timer_StopProtection(Handle timer, any userid)
if (IsValidClient(client) && IsPlayerAlive(client)) if (IsValidClient(client) && IsPlayerAlive(client))
{ {
g_bClientProtection[client] = false; g_bClientProtection[client] = false;
Client_ChangeWeapon(client, "weapon_knife"); 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 if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one
{ {
GivePlayerItem(client, "weapon_knife"); GivePlayerItem(client, "weapon_knife");
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client)); if (GetClientTeam(client) == CS_TEAM_T)
{
CreateTimer(1.0, Timer_SwitchKnife, GetClientOfUserId(client));
}
} }
} }
return Plugin_Handled; return Plugin_Handled;