Export and Events
ADD NEW TEXT
To add a text, we first need code that uses loops. Now we will replace any DrawText with the frkn-text system
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if frkncraftv2action then
for k, v in pairs(FRKN.CraftSystem["Pos"]) do
local distance = #(GetEntityCoords(PlayerPedId()) - v)
if distance < 3.0 then
if FRKN.Job then
if ESX.GetPlayerData().job.name == FRKN.JobName then
DrawText3D(v.x, v.y, v.z + 0.2, "[E] - Craft")
if IsControlJustReleased(0, 38) then
TriggerEvent('frkn-craftv2:openMenu')
end
end
else
DrawText3D(v.x, v.y, v.z + 0.2, "[E] - Craft")
if IsControlJustReleased(0, 38) then
TriggerEvent('frkn-craftv2:openMenu')
end
end
end
end
else
Citizen.Wait(500)
end
end
end)
exports["frkn-text"]:openTextUi(item,v,3,"pink")
Citizen.CreateThread(function()
local sleep = 1000
while true do
if frkncraftv2action then
for k, v in pairs(FRKN.CraftSystem["Pos"]) do
local distance = #(GetEntityCoords(PlayerPedId()) - v)
if distance ~= -1 and distance <= 2.5 then
if FRKN.Job then
if ESX.GetPlayerData().job.name == FRKN.JobName then
item = {
["item"] = {
[1] = {name = "Open",event = "frkn-craftv2:open" , icon = "fa fa-mouse-pointer"},
[2] = {name = "Close",event = "frkn-craftv2:close" , icon = "fa fa-close"},
}}
exports["frkn-text"]:openTextUi(item,v,3,"pink")
end
else
item = {
["item"] = {
[1] = {name = "Open",event = "frkn-craftv2:open" , icon = "fa fa-mouse-pointer"},
[2] = {name = "Close",event = "frkn-craftv2:close" , icon = "fa fa-close"},
}}
exports["frkn-text"]:openTextUi(item,v,3,"pink")
sleep = 1
end
end
end
end
Citizen.Wait(sleep)
end
end)
Last updated