Hi there , after many attempts I decided to come here to ask for help.
I’m trying to create a new function that can be called in both side (client/server).
I noticed that vRP.playAnim can be called in both sides but it name was created with tvRP and i can’t understand how to create new function with the same example.
-- function(vrp/client)
function tvRP.playAnim(upper,seq,looping)
-- in any-script(client-side)
vRP = Proxy.getInterface('vRP')
vRP.playAnim(false, {{"amb@medic@standing@kneel@idle_a", "idle_a"}}, true)
-- in any-script(server-side)
vRPclient = Tunnel.getInterface("vRP")
vRPclient._playAnim(source,false,{{"mini@repair","fixing_a_player"}},false)
I would like to create a new function that return some value of a table , I thinks it be easy , but I can’t called in both sides(client/server).
My example is :
-- vrp/modules(server-side)
local expTable = {
["key"] = { "value1","value2","value3" },
["key2"] = { "value3","value2","value1" }
}
function vRP.expFunction(key)
if expTable[key] then
return expTable[key][1]
end
end
-- in any-script(client-side)
vRP = Proxy.getInterface('vRP')
vRP.expFunction(key)
-- in any-script(server-side)
vRP = Proxy.getInterface('vRP')
vRP.expFunction(key)
For test the example above I used RegisterCommand and print to show the values like this :
-- test in server-side
RegisterCommand("server", function(source,args,rawCommand)
local key = "key"
local fun = vRP.expFunction(key)
if fun == "value1" then
print("local fun = "..fun)
else
print(fun)
end
end)
-- test in client-side
RegisterCommand("client", function(source,args,rawCommand)
local key = "key2"
local fun = vRP.expFunction(key)
if fun == "value3" then
print("local fun = "..fun)
else
print(fun)
end
end)
After do the commands above the results were :
– server-side
![]()
– client-side
![]()
You can see that the vRP function on the client-side didn’t return the “value 3” for printing.
I would like to understand how the vRP functions works to create a new function , thankful
.