I making simple class wars plugin, which forcing players to their random class, but after Pyro update it was broken in some cases.
When previous round have for ex. Heavy and next class is Sniper, server crushing when one of players spawning with new class. Crushing always when next class is sniper. When i banning class sniper, bug do not appearing. And crushing in random cases, i tryed to repeat this bug, but this bug seems have special combination of weapons...
Maybe, someone knows the answer?
https://crash.limetech.org/ll7qgvi3a24r
PHP Code:
public Event_RoundWin(Handle:event, const String:name[], bool:dontBroadcast)
{
gClassRed = GetRandomInt(1, 9);
gClassBlue = GetRandomInt(1, 9);
}
public Event_PlayerSpawned(Handle:hEvent, const String:strEventName[], bool:bDontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(IsValidClient(client))
{
new team = TF2_GetClientTeam(client);
new TFClassType:settedClass = (team == TFTeam_Red) ? gClassRed : gClassBlue;
if(TF2_GetPlayerClass(client) != settedClass)
{
TF2_SetPlayerClass(client, settedClass);
TF2_RespawnPlayer(client);
}
}
}