Skip to content

Commit

Permalink
Merge pull request #833 from edgyaf/master
Browse files Browse the repository at this point in the history
fix custom skin model id range
  • Loading branch information
Hual authored Jan 9, 2024
2 parents fc5b4c8 + fed6208 commit d6e24d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions SDK/include/values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ constexpr float MIN_WORLD_BOUNDS = -20000.0f;
constexpr int MAX_TEXTDRAW_STR_LENGTH = 800;
constexpr int MAX_VEHICLE_CARRIAGES = 3;
constexpr int MAX_GAMETEXT_STYLES = 16;
constexpr int MIN_CUSTOM_SKIN_ID = 20001;
constexpr int MAX_CUSTOM_SKIN_ID = 30000;
constexpr int MIN_CUSTOM_OBJECT_ID = -30000;
constexpr int MAX_CUSTOM_OBJECT_ID = -1000;

enum Key
{
Expand Down
6 changes: 3 additions & 3 deletions Server/Components/CustomModels/models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ class CustomModelsComponent final : public ICustomModelsComponent, public Player
return false;
}

if (type == ModelType::Skin && !(id >= 20000 && id <= 30000))
if (type == ModelType::Skin && !(id >= MIN_CUSTOM_SKIN_ID && id <= MAX_CUSTOM_SKIN_ID))
return false;
else if (type == ModelType::Object && !(id >= -30000 && id <= -1000))
else if (type == ModelType::Object && !(id >= MIN_CUSTOM_OBJECT_ID && id <= MAX_CUSTOM_OBJECT_ID))
return false;
else if (baseModels.find(id) != baseModels.end())
{
Expand Down Expand Up @@ -648,7 +648,7 @@ class CustomModelsComponent final : public ICustomModelsComponent, public Player
{
// Check if model is default one (base).
// If so, there's no custom model to be returned.
if (baseModelIdOrInput >= 0 && baseModelIdOrInput <= 20000)
if (baseModelIdOrInput >= 0 && baseModelIdOrInput < MIN_CUSTOM_SKIN_ID)
return false;

// Check if input is valid custom model.
Expand Down

0 comments on commit d6e24d6

Please sign in to comment.