Changed createshop to registershop
dont forget to update usibg cache system for clothing
This commit is contained in:
1 parent
13e0d0bb98
commit
ba111f1b52
14 files changed
+139
-15
No files matched your search
@@ -5,6 +5,8 @@ Clothing = Clothing or {}
|
||||
ClothingBackup = {}
|
||||
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
||||
Ultility = Utility or Require('lib/utility/client/utility.lua')
|
||||
Cache = Cache or Require('lib/cache/shared/cache.lua')
|
||||
|
||||
|
||||
function Clothing.IsMale()
|
||||
local ped = PlayerPedId()
|
||||
@@ -75,6 +77,95 @@ Clothing.UpdateAppearanceBackup = function(data)
|
||||
ClothingBackup = data
|
||||
end
|
||||
|
||||
Clothing.RunningDebug = false
|
||||
Clothing.Cache = nil -- maybe change this to the actual cache system???!? For future not lazy me
|
||||
|
||||
Cache.Create('Clothing', function()
|
||||
local ped = Cache.Get('Ped')
|
||||
local appearance = Clothing.GetAppearance(ped)
|
||||
if Table.Compare(Clothing.Cache, appearance) then
|
||||
return false
|
||||
end
|
||||
return appearance
|
||||
end, 1000)
|
||||
|
||||
local onChange = nil
|
||||
Clothing.ToggleDebugging = function()
|
||||
|
||||
if Clothing.RunningDebug then
|
||||
Clothing.RunningDebug = false
|
||||
print("Clothing Debugging Disabled")
|
||||
return Cache.RemoveOnChange('Clothing', onChange)
|
||||
end
|
||||
Clothing.RunningDebug = true
|
||||
print("Clothing Debugging Enabled")
|
||||
|
||||
if Clothing.OpenMenu then
|
||||
Clothing.OpenMenu()
|
||||
end
|
||||
|
||||
onChange = Cache.OnChange('Clothing', function(new, old)
|
||||
print("Clothing Debugging", new)
|
||||
for k, v in pairs(old.components) do
|
||||
if v.component_id then
|
||||
if new.components[k].drawable ~= v.drawable or new.components[k].texture ~= v.texture then
|
||||
print("Component ID: " .. v.component_id .. " Drawable: " .. new.components[k].drawable .. " Texture: " .. new.components[k].texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
for k, v in pairs(old.props) do
|
||||
if v.prop_id then
|
||||
if new.props[k].drawable ~= v.drawable or new.props[k].texture ~= v.texture then
|
||||
print("Prop ID: " .. v.prop_id .. " Drawable: " .. new.props[k].drawable .. " Texture: " .. new.props[k].texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
-- CreateThread(function()
|
||||
-- while Clothing.RunningDebug do
|
||||
-- Wait(3)
|
||||
-- local ped = PlayerPedId()
|
||||
-- if ped then
|
||||
-- if not Clothing.Cache then
|
||||
-- Clothing.Cache = Clothing.GetAppearance(ped)
|
||||
-- end
|
||||
-- for k, v in pairs(Clothing.Cache.components) do
|
||||
-- if v.component_id then
|
||||
-- local drawable = GetPedDrawableVariation(ped, v.component_id)
|
||||
-- local texture = GetPedTextureVariation(ped, v.component_id)
|
||||
-- if drawable ~= v.drawable or texture ~= v.texture then
|
||||
-- print("Component ID: " .. v.component_id .. " Drawable: " .. drawable .. " Texture: " .. texture)
|
||||
-- Clothing.Cache.components[k].drawable = drawable
|
||||
-- Clothing.Cache.components[k].texture = texture
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- for k, v in pairs(Clothing.Cache.props) do
|
||||
-- if v.prop_id then
|
||||
-- local drawable = GetPedPropIndex(ped, v.prop_id)
|
||||
-- local texture = GetPedPropTextureIndex(ped, v.prop_id)
|
||||
-- if drawable ~= v.drawable or texture ~= v.texture then
|
||||
-- print("Prop ID: " .. v.prop_id .. " Drawable: " .. drawable .. " Texture: " .. texture)
|
||||
-- Clothing.Cache.props[k].drawable = drawable
|
||||
-- Clothing.Cache.props[k].texture = texture
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- -- esc key to exit
|
||||
-- if IsControlJustPressed(0, 177) then
|
||||
-- Clothing.RunningDebug = false
|
||||
-- print("Clothing Debugging Disabled")
|
||||
-- end
|
||||
-- end
|
||||
-- Clothing.Cache = nil
|
||||
-- end)
|
||||
end
|
||||
|
||||
RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
|
||||
Clothing.ToggleDebugging()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
||||
Clothing.SetAppearance(PlayerPedId(), data)
|
||||
end)
|
||||
@@ -91,4 +182,6 @@ RegisterCommand("clothing:copy", function(source, args, rawCommand)
|
||||
Clothing.CopyAppearanceToClipboard()
|
||||
end)
|
||||
|
||||
|
||||
|
||||
return Clothing
|
||||
Reference in new issue
Block a user