Yo @negbook Could you make another example, like with ESX_drugs or somethins else, because i don’t understand how it works.
Thank you in advance
You can now using AddGroupData adding data one by once
Using RegisterGroupUsage to define what to do when Enter/Exit/EnteredSpam
It has an nice perfromance method/trick to do the detections of these locations.
Just imagine some datas that have {x=123,y=123,z=123,otherdatas…}
when you arrived some data’s location,then callback that location’s data {x=123,y=123,z=123,otherdatas…}
RegisterNetEvent("messages:getfirstDatas")
AddEventHandler(
"messages:getfirstDatas",
function(msgtbl)
if msgtbl then
Messages = msgtbl
local msgs = {}
for i = 1, #Messages do
local data = json.decode(Messages[i].data)
local datas = {
id = Messages[i].id,
dislike = Messages[i].dislike,
like = Messages[i].like,
x = data.x,
y = data.y,
z = data.z,
heading = data.heading,
heading = heading,
dialog_group = data.dialog_group,
dialog_main = data.dialog_main,
dialog_sub = data.dialog_sub,
playername = data.playername,
identifier = data.identifier,
inputGroup = 2,
controlKey = 38,
helptext = "press E to open menu",
cbsendsors = {
IsControlJustReleased = function()
print("hi")
end,
IsControlJustPressed = function(data)
print(data[1].group)
end
}
}
table.insert(msgs, datas)
Arrival.AddGroupData("Marker", datas)
Arrival.AddGroupData("KeyHelp", datas)
end
Arrival.RegisterGroupUsage(
"KeyHelp",
{
onEnter = function(data)
print("KeyHelp enter")
TriggerEvent(
"CallScaleformMovie",
"instructional_buttons",
function(run, send, stop, handle)
run("CLEAR_ALL")
stop()
run("SET_CLEAR_SPACE")
send(200)
stop()
for i = 1, #(data) do
local v = data[i]
run("SET_DATA_SLOT")
send(
i - 1,
GetControlInstructionalButton(v.inputGroup, v.controlKey, true),
v.helptext
)
stop()
end
run("SET_BACKGROUND_COLOUR")
send(0, 0, 0, 22)
stop()
run("SET_BACKGROUND")
stop()
run("DRAW_INSTRUCTIONAL_BUTTONS")
stop()
TriggerEvent("DrawScaleformMovie", "instructional_buttons")
end
)
end,
onExit = function(data)
print("KeyHelp exit")
TriggerEvent("EndScaleformMovie", "instructional_buttons")
TriggerEvent(
"CallScaleformMovie",
"game_stream2",
function(run, send, stop, handle)
run("DARKSOULS_MSGS_END")
stop()
end
)
end,
onSpam = function(data)
local agzi = data
for i = 1, #(agzi) do
local v = agzi[i]
if v.cbsendsors then
for k, c in pairs(v.cbsendsors) do
if _G[k] and _G[k](v.inputGroup, v.controlKey) then
c(data)
end
end
end
end
end,
range = 1.0
}
)
Arrival.RegisterGroupUsage(
"Marker",
{
onEnter = function(data)
print("marker enter")
end,
onExit = function(data)
print("marker exit")
end,
onSpam = function(data)
for i = 1, #(data) do
local v = data[i]
DrawMarker(
8,
v.x,
v.y,
v.z - 0.8,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.1,
1.1,
2.0,
255,
88,
0,
128,
0,
0,
2,
0,
0,
0,
0
)
DrawMarker(
8,
v.x,
v.y,
v.z - 0.8,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
2.0,
0,
0,
0,
128,
0,
0,
2,
0,
0,
0,
0
)
end
end,
range = 15.0
}
)
end
end
)