Skip to content

Commit

Permalink
fix missing tonumber in getElementData
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-A-Rocha committed Sep 2, 2024
1 parent 19ff9e4 commit 600b26c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions newmodels_reborn/scripts/core/client_logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ local function isCustomModelInUse(customModel, loadedModel)
if loadedModel then
for _, elementType in pairs(loadedModel.elementTypes) do
for _, v in pairs(getElementsByType(elementType, root, true)) do
if getElementData(v, getCustomModelDataKey(elementType)) == customModel then
if tonumber(getElementData(v, getCustomModelDataKey(elementType))) == customModel then
return true
end
end
Expand Down Expand Up @@ -213,7 +213,7 @@ local function freeAllocatedModelIfUnused(customModel)
end

local function setElementCustomModel(element)
local customModel = getElementData(element, getCustomModelDataKey(element))
local customModel = tonumber(getElementData(element, getCustomModelDataKey(element)))
if not customModel then return end
if not loadedModels[customModel] then
loadCustomModel(customModel, element)
Expand Down Expand Up @@ -255,14 +255,14 @@ end)

addEventHandler("onClientElementStreamOut", root, function()
if not isValidElement(source) then return end
local customModel = getElementData(source, getCustomModelDataKey(source))
local customModel = tonumber(getElementData(source, getCustomModelDataKey(source)))
if not customModel then return end
freeAllocatedModelIfUnused(customModel)
end)

addEventHandler("onClientElementDestroy", root, function()
if not isValidElement(source) then return end
local customModel = getElementData(source, getCustomModelDataKey(source))
local customModel = tonumber(getElementData(source, getCustomModelDataKey(source)))
if not customModel then return end
freeAllocatedModelIfUnused(customModel)
end)
Expand Down

0 comments on commit 600b26c

Please sign in to comment.