Ignore invalid survivor types

This commit is contained in:
Jackz 2022-11-11 11:05:07 -06:00
parent d268b498df
commit da516e0894
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
2 changed files with 6 additions and 2 deletions

View file

@ -168,9 +168,13 @@ public Action Event_PlayerToBot(Handle event, char[] name, bool dontBroadcast)
if (g_Models[player][0] != '\0') if (g_Models[player][0] != '\0')
{ {
int playerType = GetEntProp(player, Prop_Send, "m_survivorCharacter"); int playerType = GetEntProp(player, Prop_Send, "m_survivorCharacter");
if(playerType >= 0 && playerType <= 7) {
SetEntProp(bot, Prop_Send, "m_survivorCharacter", playerType); SetEntProp(bot, Prop_Send, "m_survivorCharacter", playerType);
SetEntityModel(bot, g_Models[player]); // Restore saved model. Player model is hunter at this point
SetClientInfo(bot, "name", survivor_names[playerType]); SetClientInfo(bot, "name", survivor_names[playerType]);
} else {
PrintToServer("[l4d_survivor_identity_fix]: Ignoring player's (%N) m_survivorCharacter due to out of range (%d)", player, playerType);
}
SetEntityModel(bot, g_Models[player]); // Restore saved model. Player model is hunter at this point
} }
} }