Fixed selected class not restored after being mother zombie.

This commit is contained in:
richard
2009-07-22 14:06:18 +02:00
parent 8fc99720c7
commit 0019a52ca8
3 changed files with 111 additions and 22 deletions

View File

@ -60,6 +60,9 @@ ClassOnClientDisconnect(client)
{
// Disable class attributes with timers.
ClassHealthRegenStop(client);
// Reset previously selected class indexes.
ClassResetPreviousIndexes(client);
}
/**
@ -73,13 +76,13 @@ ClassOnClientSpawn(client)
decl String:steamid[16];
decl String:classname[64];
// Check if the player is alive.
// Check if the player is dead.
if (!IsPlayerAlive(client))
{
return;
}
// Check if there are valid classes. Block this event if classes aren't
// Check if there are no valid classes. Block this event if classes aren't
// done loading.
if (!ClassValidated)
{
@ -89,6 +92,9 @@ ClassOnClientSpawn(client)
// Reset attributes by triggering death event.
ClassOnClientDeath(client);
// Restore previously selected classes if available.
ClassRestoreIndexes(client);
// Cache original player model.
GetClientModel(client, originalmodel, sizeof(originalmodel));
strcopy(ClassOriginalPlayerModel[client], PLATFORM_MAX_PATH, originalmodel);
@ -219,6 +225,9 @@ ClassOnClientInfected(client, bool:motherzombie = false)
// class skills aren't improved.
motherzombie = false;
// Save class index to be restored next time.
ClassPrevious[client][ZR_CLASS_TEAM_ZOMBIES] = classindex;
// Change class.
classindex = motherindex;
}