fixing client crash by adding delay to respawning
This commit is contained in:
parent
72027c82a0
commit
d48bb8e343
@ -1387,12 +1387,24 @@ public Action SelectWavebasedHuman(int client)
|
||||
if (GetClientTeam(client) == CS_TEAM_T)
|
||||
{
|
||||
ChangeClientTeam(client, CS_TEAM_CT); //default putting humans to CT team
|
||||
CS_RespawnPlayer(client); //respawning because changeclientteam kills the player on css
|
||||
CreateTimer(1.0, Timer_delayedRespawn, GetClientUserId(client));
|
||||
}
|
||||
ModelSelection(client, 2, g_iClientHumanClasses[client]);
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action Timer_delayedRespawn(Handle timer, any userid)
|
||||
{
|
||||
int client = GetClientOfUserId(userid);
|
||||
if (!IsValidClient(client))
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
CS_RespawnPlayer(client); //respawning because changeclientteam kills the player on css
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -1404,7 +1416,7 @@ public Action SelectWaveBasedZM(int client, int state)
|
||||
if (GetClientTeam(client) == CS_TEAM_CT)
|
||||
{
|
||||
ChangeClientTeam(client, CS_TEAM_T); //default putting bots to t
|
||||
CS_RespawnPlayer(client); //respawning because changeclientteam kills the player on css
|
||||
CreateTimer(1.0, Timer_delayedRespawn, GetClientUserId(client));
|
||||
}
|
||||
//state 0 was bot, state 1 was real player.
|
||||
if (!IsValidClient(client))
|
||||
@ -1494,12 +1506,12 @@ public Action ModelSelection(int client, int state, int modelIndex)
|
||||
g_bFallDamage[client] = false;
|
||||
if (state < 2)
|
||||
{
|
||||
CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, client);
|
||||
CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, GetClientUserId(client));
|
||||
//Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, client);
|
||||
CreateTimer(g_fHumanSpawnProtection, Timer_StopProtection, GetClientUserId(client));
|
||||
//Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1));
|
||||
}
|
||||
if (state < 2) //setting the zombie health here using the HealthScaleAbility.
|
||||
@ -1648,8 +1660,11 @@ public Action Timer_Respawn(Handle timer, any userid)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Timer_StopProtection(Handle timer, int client)
|
||||
public Action Timer_StopProtection(Handle timer, any userid)
|
||||
{
|
||||
int client = GetClientOfUserId(userid);
|
||||
if (client == 0)
|
||||
return Plugin_Continue;
|
||||
if (IsValidClient(client))
|
||||
g_bClientProtection[client] = false;
|
||||
return Plugin_Handled;
|
||||
@ -1868,17 +1883,23 @@ public Action EventPlayerJump(Handle event, const char[] name, bool dontBroadcas
|
||||
// Get all required event info.
|
||||
int index = GetClientOfUserId(GetEventInt(event, "userid"));
|
||||
// Fire post player_jump event.
|
||||
CreateTimer(0.0, EventPlayerJumpPost, index);
|
||||
CreateTimer(0.0, EventPlayerJumpPost, GetClientUserId(index));
|
||||
return Plugin_Handled;
|
||||
}
|
||||
public Action EventPlayerJumpPost(Handle timer, int client)
|
||||
|
||||
public Action EventPlayerJumpPost(Handle timer, any userid)
|
||||
{
|
||||
int client = GetClientOfUserId(userid);
|
||||
if (!IsValidClient(client))
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
// If client isnt in-game, then stop.
|
||||
if (!IsClientInGame(client))
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
// Get class jump multipliers.
|
||||
// Get class jump multipliers.
|
||||
float distancemultiplier = g_fJumpDistanceIndex[client];
|
||||
float heightmultiplier = g_fJumpHeightIndex[client];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user