-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
128 lines (111 loc) · 3.16 KB
/
client.lua
File metadata and controls
128 lines (111 loc) · 3.16 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
local RSGCore = exports['rsg-core']:GetCoreObject()
local prompt = GetRandomIntInRange(0, 0xffffff)
local menubutton
local active = false
local city = ""
local poster_table = {}
local charidentifier
local group
function Send_Poster(bool)
SetNuiFocus(bool, bool)
guiEnabled = bool
SendNUIMessage({
resourceName = GetCurrentResourceName(),
type = "ui",
status = bool,
})
end
function Show_Poster(bool)
SetNuiFocus(bool, bool)
guiEnabled = bool
SendNUIMessage({
resourceName = GetCurrentResourceName(),
type = "poster_table",
status = bool,
charidentifier = charidentifier,
group = group,
table_for_json = poster_table
})
end
CreateThread(function()
for k,v in pairs(Config.Posters) do
exports['rsg-core']:createPrompt(v.name, v.coords, 0xF3830D8E, 'Open ' .. v.name, {
type = 'client',
event = 'qc-pinboard:client_getPoster',
args = {v.city},
})
end
end)
RegisterNetEvent('qc-pinboard:client_getPoster', function(b)
--print('args ' .. json.encode(args))
--local _city = args.city
--local a = table.unpack({"Velantine"})
--print(a)
local _city = b
TriggerServerEvent("qc-pinboard:get_posters", _city)
active = true
Wait(1000)
Show_Poster(true)
end)
RegisterNetEvent('qc-pinboard:send_list')
AddEventHandler('qc-pinboard:send_list', function(table,x,y)
poster_table = table
charidentifier = x
for k,_ in pairs(y) do
if Config.Groups[k] then
group = true
break
end
group = false
end
end)
Citizen.CreateThread(function()
for k,v in pairs(Config.Posters) do
local blips = N_0x554d9d53f696d002(1664425300, v.coords[1], v.coords[2], v.coords[3])
SetBlipSprite(blips, 1735233562, 1)
SetBlipScale(blips, 1.0)
Citizen.InvokeNative(0x9CB1A1623062F402, blips, "Notice Board")
end
end)
RegisterNUICallback('send_to_poster', function(data, cb)
for k,v in pairs(Config.Posters) do
local coords = GetEntityCoords(PlayerPedId())
if GetDistanceBetweenCoords(coords.x, coords.y, coords.z, v.coords[1], v.coords[2], v.coords[3], false) < 10.0 then
if data.Title ~= "" then
local s = data.Link
--TriggerEvent("vorp:TipBottom", "You pinned a paper to the notice board", 4000)
TriggerServerEvent("qc-pinboard:set_link", data.Title, s:gsub("%'", ""), v.city)
Citizen.Wait(1000)
TriggerServerEvent("qc-pinboard:get_posters", v.city)
Send_Poster(false, false)
Show_Poster(false, false)
SetNuiFocus(false, false)
guiEnabled = false
active = false
else
Send_Poster(false, false)
Show_Poster(false, false)
SetNuiFocus(false, false)
guiEnabled = false
active = false
end
end
end
end)
RegisterNUICallback('exit', function(data, cb)
Send_Poster(false, false)
Show_Poster(false, false)
SetNuiFocus(false, false)
guiEnabled = false
active = false
cb('ok')
end)
RegisterNUICallback('removepin', function(data, cb)
Send_Poster(false, false)
Show_Poster(false, false)
SetNuiFocus(false, false)
guiEnabled = false
active = false
cb('ok')
TriggerServerEvent("qc-pinboard:removeposter", data.id)
end)