Hello,
I don’t re upload your script i just add a payment systeme work fine with vrp.
Juste add this shit
in the end of client.lua file :
-- ADD BY GRAINCHEUX
RegisterNetEvent('hookers:success')
AddEventHandler('hookers:success', function()
vRP.notify({"Payer ~r~200$."})
end)
RegisterNetEvent('hookers:notenough')
AddEventHandler('hookers:notenough', function()
vRP.notify({"~r~Pas assez d'argent."})
end)
into function also into client.lua :
TriggerServerEvent('hookers:checkmoney') -- ADD BY GRAINCHEUX
create a new file into ressource name : server.lua
--Settings--
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","Hookers")
-- ADD BY GRAINCHEUX
RegisterServerEvent('hookers:checkmoney')
AddEventHandler('hookers:checkmoney', function(hook)
local user_id = vRP.getUserId({source})
local player = vRP.getUserSource({user_id})
if vRP.tryPayment({user_id,200}) then
TriggerClientEvent('hookers:success', player)
else
TriggerClientEvent('hookers:notenough', player)
end
end)
and modify your ressource.lua for add dependency et other shit
description "vRP carwash"
--ui_page "ui/index.html"
dependency "vrp"
client_scripts{
"Proxy.lua",
"client.lua"
}
server_scripts{
"@vrp/lib/utils.lua",
"server.lua"
}
You can also add proxy (Proxy.lua)
-- PROXY CLIENT-SIDE VERSION (https://github.com/ImagicTheCat/vRP)
-- Proxy interface system, used to add/call functions between resources
Proxy = {}
local proxy_rdata = {}
local function proxy_callback(rvalues) -- save returned values, TriggerEvent is synchronous
proxy_rdata = rvalues
end
local function proxy_resolve(itable,key)
local iname = getmetatable(itable).name
-- generate access function
local fcall = function(args,callback)
if args == nil then
args = {}
end
TriggerEvent(iname..":proxy",key,args,proxy_callback)
return table.unpack(proxy_rdata) -- returns
end
itable[key] = fcall -- add generated call to table (optimization)
return fcall
end
--- Add event handler to call interface functions (can be called multiple times for the same interface name with different tables)
function Proxy.addInterface(name, itable)
AddEventHandler(name..":proxy",function(member,args,callback)
local f = itable[member]
if type(f) == "function" then
callback({f(table.unpack(args))}) -- call function with and return values through callback
-- CancelEvent() -- cancel event doesn't seem to cancel the event for the other handlers, but if it does, uncomment this
else
-- print("error: proxy call "..name..":"..member.." not found")
end
end)
end
function Proxy.getInterface(name)
local r = setmetatable({},{ __index = proxy_resolve, name = name })
return r
end
-- END PROXY CLIENT-SIDE VERSION
And it’s work fine for me.
Thx for the script @Yadiiiig