Accessible code
Shared = {
Locale = 'en',
Notify = {
duration = 5000, -- miliseconds
position = 'top-right' -- 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left'
},
TextUI = {
position = 'right-center' -- 'right-center' or 'left-center' or 'top-center' or 'bottom-center'
},
Logs = {
enabled = true,
webhook = 'https://discord.com/api/webhooks/1241796943378911393/7ARn2slhT1tnEFQB_TY4WLUHmV7srOvWTpcL--sfn4ztNIv8BzpewV-_6aE_F6hxZr-c',
servername = 'Uniq Scripts',
color = 6579450,
icon_url = 'https://dunb17ur4ymx4.cloudfront.net/webstore/logos/046c8efd198a2806b6ae46490f6aa780a225125e.png'
},
Commands = {
adminmenu = {
name = 'objectcreator', -- command for accessing admin panel
restricted = 'group.admin', -- group that will have access to the command
}
},
Keys = { -- https://docs.fivem.net/docs/game-references/controls/
finish = 191,
cancel = 194,
},
targetType = 'ox', -- ox/qb - if on ESX use "ox"
spawnObjectDistance = 100, -- the distance at which objects spawn for players
collectibleSettings = { -- settings for collectible objects
distance = 5, -- the distance from which it is possible to collect the object
key = 38, -- key to collect the object - [default: E]
keyLabel = 'E',
targetIcon = 'fas fa-hand-holding',
animation = {
dict = 'anim@amb@business@coc@coc_unpack_cut@',
clip = 'fullcut_cycle_v1_cokecutter'
},
},
}
function sendNotify(title, description, type)
lib.notify({
title = title,
description = description,
duration = Shared.Notify.duration,
type = type,
position = Shared.Notify.position
})
end
RegisterNetEvent('objectcreator:notify', sendNotify)
-- Text UI
function textUI(description, icon)
lib.showTextUI(description, {
position = Shared.TextUI.position,
icon = icon
})
end
function hideTextUI()
lib.hideTextUI()
end
-- Progress Bar
function progressBar(duration, label, dict, clip)
lib.progressBar({
duration = duration,
label = label,
useWhileDead = false,
canCancel = false,
disable = {
car = true,
},
anim = {
dict = dict,
clip = clip
}
})
end
-- 3D Text
function DrawText3D(x, y, z, text)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
local px, py, pz = table.unpack(GetGameplayCamCoords())
SetTextScale(0.5, 0.5)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
-- Draw Marker
function DrawMarkerAtCoords(x, y, z, scale)
DrawMarker(1, x, y, z, 0, 0, 0, 0, 0, 0, scale.x, scale.y, scale.z, 255, 255, 255, 255, false, true, 2, nil, nil, false)
end
-- "object table":
-- object: string
-- isDoor: boolean
-- restrictedJobs: table
-- collision: boolean
-- interaction: false or table (target/text_ui/text_3d/marker)
-- frozen: boolean
-- collectible: boolean
-- temporary: boolean
-- coords: table (x, y, z)
-- heading: number
-- "point table":
-- coords: table(x, y, z)
-- heading: number
-- distance: number
-- data: table (object table data)
-- tableid: string (object unique id)
... extra lua code after objects are created (automatically generated)
-- Discord Logs
local webhook = Shared.Logs.webhook
function logger(message)
if Shared.Logs.enabled then
if webhook ~= '' then
PerformHttpRequest(webhook, function(status) end, 'POST', json.encode({
username = cache.resource,
embeds = {{
color = Shared.Logs.color,
title = Shared.Logs.servername,
description = message,
footer = {
text = os.date(),
icon_url = Shared.Logs.icon_url
}
}}
}), { ['Content-Type'] = 'application/json' })
end
end
end
-- Collectible Function
function collectibleReward()
-- code for sending reward after collecting object
end
Last updated