Closed SuelTheDev closed 1 year ago
From the information I understand you can access the client side API in the normal way with SendNUIMessage, to give the server the information from a NUICallback you just need to use the tunnel functionality.
As for the loading client side the vrp_client.lua is not needed and instead inside at the top of the client.lua paste the following information.
-- init vRP server context top of client.lua Tunnel = module("vrp", "lib/Tunnel") Proxy = module("vrp", "lib/Proxy")
local cvRP = module("vrp", "client/vRP") vRP = cvRP()
local pvRP = {} -- load script in vRP context pvRP.loadScript = module Proxy.addInterface("vRP", pvRP)
if any additional information is required feel free to dm me on discord in the vrp channel
I have some questions.
I'm migrating my scripts to vRP 2, however, researching I saw that I need to load the script in the vRP context to give access to the API, on the server side it's not a problem, but on the client side, a doubt arose, since my script will have a NUI, how do I redirect the requests, should I set the url to https://vrp/... ? But other scripts will also have UI, and is it possible to access the client side API without the vRP.loadScript?
My code.
vrp_client.lua
client.lua
and my fxmanifest.lua