Fixed original models not restored when using zr_human on a player.
This commit is contained in:
parent
a0d8209c6a
commit
1cc0fc4dda
|
@ -101,9 +101,20 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
|||
// Check if the user specified no change.
|
||||
else if (strcmp(modelpath, "default", false) == 0)
|
||||
{
|
||||
// Don't change the model.
|
||||
// Get current model.
|
||||
GetClientModel(client, modelpath, sizeof(modelpath));
|
||||
|
||||
// Restore original model if not already set.
|
||||
if (!StrEqual(ClassOriginalPlayerModel[client], modelpath))
|
||||
{
|
||||
strcopy(modelpath, sizeof(modelpath), ClassOriginalPlayerModel[client]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wanted model is already set, don't change.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
SetEntityModel(client, modelpath);
|
||||
return true;
|
||||
|
|
|
@ -69,6 +69,10 @@ ClassOnClientDisconnect(client)
|
|||
*/
|
||||
ClassOnClientSpawn(client)
|
||||
{
|
||||
decl String:originalmodel[PLATFORM_MAX_PATH];
|
||||
decl String:steamid[16];
|
||||
decl String:classname[64];
|
||||
|
||||
// Check if the player is alive.
|
||||
if (!IsPlayerAlive(client))
|
||||
{
|
||||
|
@ -85,10 +89,12 @@ ClassOnClientSpawn(client)
|
|||
// Reset attributes by triggering death event.
|
||||
ClassOnClientDeath(client);
|
||||
|
||||
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
|
||||
// Cache original player model.
|
||||
GetClientModel(client, originalmodel, sizeof(originalmodel));
|
||||
strcopy(ClassOriginalPlayerModel[client], PLATFORM_MAX_PATH, originalmodel);
|
||||
|
||||
decl String:steamid[16];
|
||||
decl String:classname[64];
|
||||
// Get random class setting.
|
||||
new bool:randomclass = GetConVarBool(g_hCvarsList[CVAR_CLASSES_RANDOM]);
|
||||
|
||||
// Assign random classes if enabled. Always do it for bots.
|
||||
GetClientAuthString(client, steamid, sizeof(steamid));
|
||||
|
|
|
@ -366,6 +366,12 @@ new bool:ClassPlayerAdminMode[MAXPLAYERS + 1];
|
|||
*/
|
||||
new ClassPlayerNextAdminClass[MAXPLAYERS + 1];
|
||||
|
||||
/**
|
||||
* Cache for storing original model path before applying custom models. Used
|
||||
* when restoring to old model.
|
||||
*/
|
||||
new String:ClassOriginalPlayerModel[MAXPLAYERS + 1][PLATFORM_MAX_PATH];
|
||||
|
||||
#include "zr/playerclasses/filtertools"
|
||||
#include "zr/playerclasses/attributes"
|
||||
#include "zr/playerclasses/apply"
|
||||
|
|
Loading…
Reference in New Issue
Block a user