Jump to content

callServerFunction - callClientFunction


papam77

Recommended Posts

I only need one script with this functions for example

example

callServerFunction("getServerMaps",getLocalPlayer()) end,500,1) 
  
  
function callServerFunction(funcname, ...) 
    local arg = { ... } 
    if (arg[1]) then 
        for key, value in next, arg do 
            if (type(value) == "number") then arg[key] = tostring(value) end 
        end 
    end 
    triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) 
end 

Link to comment
I only need one script with this functions for example

example

callServerFunction("getServerMaps",getLocalPlayer()) end,500,1) 
  
  
function callServerFunction(funcname, ...) 
    local arg = { ... } 
    if (arg[1]) then 
        for key, value in next, arg do 
            if (type(value) == "number") then arg[key] = tostring(value) end 
        end 
    end 
    triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) 
end 

This is actually wrong because you are trying to call a function that hasn't been declared yet. Plus, the functions "callServerFunction" and "callClientFunction" cannot (but isn't hard to implement) return the value that is returned by the function called. The only thing in which these functions are good is that you don't need to add multiple events to do each thing.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...