Repository navigation
Expand file tree
/
Copy pathclient.lua
More file actions
64 lines (56 loc) · 1.67 KB
/
Copy pathclient.lua
File metadata and controls
64 lines (56 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local ESX = exports['es_extended']:getSharedObject()
local function OpenRelationshipUI()
SetNuiFocus(true, true)
SendNUIMessage({
action = 'open'
})
end
local function CloseRelationshipUI()
SetNuiFocus(false, false)
SendNUIMessage({
action = 'close'
})
end
RegisterNUICallback('close', function(data, cb)
CloseRelationshipUI()
cb('ok')
end)
RegisterNUICallback('uploadPhoto', function(data, cb)
local photoUrl = data.photoUrl
TriggerServerEvent('passions_relationship:uploadPhoto', photoUrl)
cb('ok')
end)
RegisterNUICallback('sendGift', function(data, cb)
local giftName = data.giftName
TriggerServerEvent('passions_relationship:sendGift', giftName)
cb('ok')
end)
RegisterNetEvent('passions_relationship:openUI')
AddEventHandler('passions_relationship:openUI', function()
OpenRelationshipUI()
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustReleased(0, 38) then -- E key
local player, distance = ESX.Game.GetClosestPlayer()
if distance ~= -1 and distance <= 3.0 then
TriggerServerEvent('passions_relationship:checkRelationship', GetPlayerServerId(player))
end
end
end
end)
exports('ox_target', function(data)
if data.entityType == 'player' then
return {
{
name = 'relationship',
label = 'Relationship',
icon = 'fa-solid fa-heart',
onSelect = function()
TriggerServerEvent('passions_relationship:checkRelationship', GetPlayerServerId(data.entity))
end
}
}
end
end)