uploaded the config files as adapted for css. changed the plugin to not load mapstart and waves on pluginstart due to it fucking up the findatamap info 0. fixed respawning when joining late or when going spectate and going back to a team again
This commit is contained in:
@@ -109,9 +109,6 @@ public void OnPluginStart()
|
||||
}
|
||||
CloseHandle( fileHandle );
|
||||
|
||||
OnMapStart();
|
||||
RetrieveWaveSettings(1);
|
||||
|
||||
//processstring
|
||||
LoadTranslations("common.phrases.txt");
|
||||
|
||||
@@ -135,6 +132,7 @@ public void OnPluginStart()
|
||||
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Post);
|
||||
HookEvent("player_hurt", EventPlayerHurt, EventHookMode_Pre);
|
||||
HookEvent("player_jump", EventPlayerJump, EventHookMode_Post);
|
||||
HookEvent("player_team", EventPlayerTeam, EventHookMode_Post);
|
||||
|
||||
//commands
|
||||
RegConsoleCmd("say", Cmd_Say);
|
||||
@@ -154,6 +152,40 @@ public void OnPluginStart()
|
||||
}
|
||||
}
|
||||
|
||||
public Action CheckPlayerTeam(Handle timer, any userid)
|
||||
{
|
||||
int client = GetClientOfUserId(userid);
|
||||
if (client == 0)
|
||||
return Plugin_Continue;
|
||||
|
||||
if (!IsValidClient(client) || IsPlayerAlive(client) || (GetClientTeam(client) != CS_TEAM_T && GetClientTeam(client) != CS_TEAM_CT)
|
||||
|| IsFakeClient(client))
|
||||
{
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
if (g_iClientRespawnCount[client] > 0)
|
||||
{
|
||||
ChangeClientTeam(client, CS_TEAM_CT); //default putting humans to CT team
|
||||
PrintToChat(client, "You have %i respawns left as human. You will respawn in %f seconds.", g_iClientRespawnCount[client], g_fRespawnTimer);
|
||||
CreateTimer(g_fRespawnTimer, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeClientTeam(client, CS_TEAM_T); //default putting humans to ZM
|
||||
PrintToChat(client, "You will respawn as a zombie in %f seconds.", g_fRespawnTimer);
|
||||
CreateTimer(g_fRespawnTimer, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action EventPlayerTeam(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
CreateTimer(1.0, CheckPlayerTeam, GetClientUserId(client));
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_CheckIfRestartNeeded(Handle timer, any userid)
|
||||
{
|
||||
//the bots dont spawn right away. therefore we have the 6 seconds delay for them to actually spawn in.
|
||||
@@ -181,18 +213,27 @@ public Action Timer_CheckIfRestartNeeded(Handle timer, any userid)
|
||||
public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
int activeBots = 0;
|
||||
int activePlayers = 0;
|
||||
for (int i = 1; i < MaxClients; i++)
|
||||
{
|
||||
if (IsValidClient(i) && IsFakeClient(i) && !IsClientSourceTV(i))
|
||||
if (!IsValidClient(i) || IsClientSourceTV(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (IsFakeClient(i))
|
||||
{
|
||||
activeBots++;
|
||||
}
|
||||
if (activeBots > 0)
|
||||
else
|
||||
{
|
||||
activePlayers++;
|
||||
}
|
||||
if (activeBots > 0 && activePlayers > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activeBots == 0)
|
||||
if (activeBots == 0 && activePlayers == 1)
|
||||
{
|
||||
CreateTimer(10.0, Timer_CheckIfRestartNeeded); //if only one guy is on a team we force a restart to spawn the bots.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user