Added nochange option in class model attribute.
This commit is contained in:
parent
32828a9179
commit
daadefbaea
@ -673,10 +673,13 @@ The list below explains all available class attributes in detail:
|
||||
model_path text Max 256 characters, not empty
|
||||
---------------------------------------------------------------------------
|
||||
The model file to use on the player, path is relative to the "cstrike"
|
||||
folder. There are two special values supported by this attribute:
|
||||
folder. There are a few special values supported by this attribute:
|
||||
|
||||
"default" - Don't change model, use default CS models.
|
||||
"default" - Use default CS models. The one players select when
|
||||
selecting team.
|
||||
"random" - Selects a random model for the current team.
|
||||
"nochange" - Don't change model. To be used in combination with
|
||||
other plugins that change model on players.
|
||||
|
||||
alpha_spawn number 0 - 255
|
||||
---------------------------------------------------------------------------
|
||||
|
@ -89,16 +89,14 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
||||
ClassGetModelPath(classindex, modelpath, sizeof(modelpath), cachetype);
|
||||
}
|
||||
|
||||
// Check if the user specified a random model.
|
||||
if (strcmp(modelpath, "random", false) == 0)
|
||||
// Check if the user specified a pre-defined model setting.
|
||||
if (StrEqual(modelpath, "random", false))
|
||||
{
|
||||
// TODO: Make a function that gets a random model from the specified team.
|
||||
ModelsGetRandomModelIndex(modelpath, sizeof(modelpath), false, true);
|
||||
Format(modelpath, sizeof(modelpath), "%s.mdl", modelpath);
|
||||
}
|
||||
|
||||
// Check if the user specified no change.
|
||||
else if (strcmp(modelpath, "default", false) == 0)
|
||||
else if (StrEqual(modelpath, "default", false))
|
||||
{
|
||||
// Get current model.
|
||||
GetClientModel(client, modelpath, sizeof(modelpath));
|
||||
@ -114,6 +112,11 @@ bool:ClassApplyModel(client, classindex, cachetype = ZR_CLASS_CACHE_PLAYER)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (StrEqual(modelpath, "nochange", false))
|
||||
{
|
||||
// Do nothing.
|
||||
return true;
|
||||
}
|
||||
|
||||
SetEntityModel(client, modelpath);
|
||||
return true;
|
||||
|
@ -162,8 +162,10 @@ stock ClassValidateAttributes(classindex)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if a model different from default or random is specified.
|
||||
if (!StrEqual(model_path, "random", false) && !StrEqual(model_path, "default", false))
|
||||
// Check if a model different from a pre-defined setting.
|
||||
if (!StrEqual(model_path, "random", false) &&
|
||||
!StrEqual(model_path, "default", false) &&
|
||||
!StrEqual(model_path, "nochange", false))
|
||||
{
|
||||
// Check if the file exists.
|
||||
if (!FileExists(model_path))
|
||||
|
Loading…
Reference in New Issue
Block a user