[Release | Utility]Arrival utilities for FXServer | Destination Check

fxserver-arrival

Arrival utilities for FXServer

[DEPENDENCIES]
Threads

[INSTALLATION]

Set it as a dependency in you fxmanifest.lua
make sure fx_version up to ‘adamant’ version

(optional)

client_scripts {
'@threads/threads.lua',
'@arrival/arrival.lua',
...

(must)

dependencies {
    'threads',
    'arrival'
}

[FUNCTION EXPORTS/EVENT]

Arrival.Register(positions,range,cb(result)) --result.data result.action result.data_arrival  (with optional)
exports.arrival:Register(positions,range,cb(result)) --result.data result.action result.data_arrival  (with dependencies)
TriggerEvent('Arrival:AddPositions',positions,range,cb(result) --result.data result.action result.data_arrival  (with dependencies)

result.action ==> 'enter' / 'exit'

[EXAMPLE]

An example edition of new_banking (Credits: Script Created By: @onlyserenity(amjedcha) edited and improved by NewWay)
in the Github link

[GITHUB]
Github : Arrival

After: 0.00(exit ATM) ~ 0.02ms(very next to ATM)
2021-02-05_022021

20210205022238
Before: 0.08ms(far away from ATM) 0.06~0.07(next to ATM)
20210205022134

5 Likes

I do it but nothing change at all, any help?

Hello, so This is a non related question, so i’m changing the blip colors and the way they look on the map, when i try to change the color but it only changes the color of the pacific bank blip and not the others? can someone help me please?


how to fix join the server script error

updated some empty checks
please update both arrival and threads script

how to fix join the server script error

sorry for my ignorance, but I have no idea how this is used, would you be so kind as to make an example, or even make a video showing how this is used? Thanks in advance

sorry for my ignorance, but I have no idea how this is used, would you be so kind as to make an example, or even make a video showing how this is used? Thanks in advance

client.zip (3.3 KB)
There is client.lua from new_banking(with out ESX for testing only).An example of how this is used.
You can simply backup origin new_banking client.lua and replace the client.lua.
You can take a look with what parts were replaced in client.lua for knowing how it works.
make sure that you moded from __resource.lua to fxmanifest.lua
and fx_version up to ‘adamant’ version


wow thank you, with that I can compare the scripts and guide me, thank you very much really, just one thing, look at this, when you approach the cashier the option to open the cashier comes out, but then if you want to return to the same cashier, the option no longer comes out opening the ATM and this error appears on the console

wow thank you, with that I can compare the scripts and guide me, thank you very much really, just one thing, look at this, when you approach the cashier the option to open the cashier comes out, but then if you want to return to the same cashier, the option no longer comes out opening the ATM and this error appears on the console

Cool! You found a bug in these lines 36~40:

        Threads.CreateLoopOnce('onSpam',0,function()
            if SpamCanDraw and Arrival.CallSpam then 
                Arrival.CallSpam[SpamCanDraw[1]](SpamCanDraw[2])
            end 
        end)

now with these it will fix.It updated to my github.

        Threads.CreateLoopOnce('onSpam',0,function()
            if SpamCanDraw and Arrival.CallSpam and Arrival.CallSpam[SpamCanDraw[1]] then 
                Arrival.CallSpam[SpamCanDraw[1]](SpamCanDraw[2])
            end 
        end)

wow now it works perfectly, it’s beautiful, thank you very much

wow now it works perfectly, it’s beautiful, thank you very much

thanks :slight_smile:
btw, a better perfromance version is updated.
both Arrival and Threads script updated.

wow now it works perfectly, it’s beautiful, thank you very much

1 Like



If really with the update it was optimized a lot, now it always consumes 0.01, but something strange happens, the option to open the menu always stops appearing, and when that happens it does not let you open any menu in any atm or bank: c

I am checking and before the update, it worked perfect

lines 92~102:
try change 2500 to 350,If it fix your problem?

                if waittime > 350 then 
                    waittime = 350
                end
            end 
            Wait(waittime)
        else 
        Wait(350)
      
        end 
    else 
        Wait(350)

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

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
)

Thank’s for this, i’ll do some test to understand how it works ! Thank you for your job dude

Good Job :smiley:

Huge Updated.
0.00~0.01ms
2021-06-25_020642

0.00 ~ 0.02ms (dependent)
2021-06-25_020620
2021-06-25_020943