Help getting information - vRP2

So I am trying to make some custom VRP2 resources, and I am having trouble finding the correct way to do things. I was trying to use some other vrp resources as examples, but they all seem to be outdated.

I am working on building a custom banking system, and server side, I am trying to get access to the vRP API.

I have this in my server.lua

local Tunnel = module(“vrp”, “lib/Tunnel”)
local Proxy = module(“vrp”, “lib/Proxy”)

local vRP = Proxy.getInterface(“vRP”)

Then further down, I have this:

local res = vRP:execute(‘vRP/getBalance’,{character_id = user_id})

Which is a statement I prepared in base.lua. When I run the command /balance (which is another function), the chat window brings back the message error: proxy call vRP:execute not found.

I am also trying to use vRP.getUserId({source}) to get the user ID of the player who initiated the command, but when doing so, I get the error error: proxy call vRP.getUserId not found.

#1, it doesn’t appear that the server is correctly loading the Proxy, and #2, I can’t seem to find the correct methods to get the information I need (it looks like the resources I am looking at are outdated, and the documentation for VRP2 isn’t very clear)

hi,

i have the same error, vRP:getUserId. Have you solve your problem, and if yes, how are you doing this ?

Any update ?

An example of what i’ve done (and its working but no idea of the version of VRP)
Its server sided, vRP.XXXX to acces server sided vrp function and vRPclient to acces client sided vrp function


local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")

vRP = Proxy.getInterface("vRP")

vRPclient = Tunnel.getInterface("vRP", "NAME OF THE MOD YOU WRITE")

RegisterServerEvent('Agri:VerifPlanter')
AddEventHandler('Agri:VerifPlanter', function(typ)
	local player = source
	local user_id = vRP.getUserId(player)
	--print("("..tostring(user_id)..") essaie de planter : "..tostring(typ))
	if vRP.tryGetInventoryItem(user_id,typ,1,false) then
		
		vRPclient._playAnim(player,false,{{'amb@world_human_gardener_plant@male@base', 'base',1}},false)
		Wait(2500)
		SetTimeout(2500,function()
			TriggerClientEvent("Agri:Spawn",player,typ)
		end)
	else
	
	end
	
end)

That’s for vRP 0.5/1.0.

first you need to load your files in the context of VRP2, second you have to reread all vRP documentation as it is now via OOP, after that you can use the normal functions.

General Doc:

Modules Doc:

I’ll be uploading an example bp for you to look at the structure, as it says in the documentation itself you can look at vrp_basic_mission, vRP-TCG or vRP’s own module structure to understand how it works