Files
community_bridge/modules/clothing/_default/server.lua
T
MrNewb c71a261115 chore(intellisense): improve parameter annotations and add missing comments
Touched up incorrect or missing Intellisense parameter annotations across several functions. Added some missing descriptions to improve editor support. Still more to do, but this is a small step forward for overall developer workflow. Also small fix in picklexp
2025-06-07 22:50:13 -04:00

58 lines
1.8 KiB
Lua

--[[This module is incomplete]]--
Clothing = Clothing or {}
Clothing.LastAppearance = Clothing.LastAppearance or {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
function Clothing.IsMale(src)
local ped = GetPlayerPed(src)
if not ped or not DoesEntityExist(ped) then return end
return GetEntityModel(ped) == `mp_m_freemode_01`
end
function Clothing.GetAppearance(src)
return Callback.Trigger('community_bridge:cb:GetAppearance', src)
end
Clothing.SetAppearance = function(src, data)
local strSrc = tostring(src)
Clothing.LastAppearance[strSrc] = Clothing.GetAppearance(src)
TriggerClientEvent('community_bridge:client:SetAppearance', src, data)
end
--- Sets a player's appearance based on gender-specific data
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
end
Clothing.RestoreAppearance = function(src)
TriggerClientEvent('community_bridge:client:RestoreAppearance', src)
end
-- RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
-- local src = source
-- Clothing.SetAppearance(src, data)
-- end)
-- RegisterNetEvent('community_bridge:client:GetAppearance', function()
-- local src = source
-- Clothing.GetAppearance(src)
-- end)
-- RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
-- local src = source
-- Clothing.RestoreAppearance(src)
-- end)
-- RegisterNetEvent('community_bridge:client:ReloadSkin', function()
-- local src = source
-- Clothing.ReloadSkin(src)
-- end)
return Clothing