ZSpawn: Hopefully fix the random deaths.

Seems it all happening together with the game logic caused some random death issues. Hopefully thats fixed now.
This commit is contained in:
2019-03-10 21:39:27 +01:00
parent 6334246ced
commit 35d7190ba2
2 changed files with 25 additions and 12 deletions

View File

@ -154,11 +154,9 @@ public Action:EventPlayerTeam(Handle:event, const String:name[], bool:dontBroadc
InfectOnClientTeam(index, team);
ImmunityOnClientTeam(index);
// Bots dont call `joinclass`. So call here.
// Fire post joinclass command. (Bots dont joinclass, so we fire it from here instead.)
if (IsFakeClient(index))
{
ZSpawnOnClientTeam(index);
}
CreateTimer(0.1, CommandPlayerClassPost, index);
return Plugin_Handled;
}
@ -340,9 +338,25 @@ public Action:EventPlayerJumpPost(Handle:timer, any:client)
*/
public Action:CommandPlayerClass(int client, const char[] command, int argc)
{
if (IsFakeClient(client))
return;
// Forward event to modules.
ZSpawnOnClientTeam(client);
// Fire post joinclass command.
CreateTimer(0.1, CommandPlayerClassPost, client);
}
/**
* Command callback (joinclass)
* Client is joining a class. *Post
*
* @param client The client.
* @param command The command performed.
* @param argc The amount of arguments.
*/
public Action:CommandPlayerClassPost(Handle:timer, any:client)
{
// If client isn't in-game, then stop.
if (!IsClientInGame(client))
{
return;
}
ZSpawnOnClientClassPost(client);
}