Jump to content

callServerFunction - callClientFunction


papam77

Recommended Posts

Posted
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 

Posted
Ty. And how can make bind around NPC ? max. 5 meters around.

You must be 5m maximum near to NPC and press "F" for call function.

you can use

  
createMarker 
onClientMarkerHit 
onClientMarkerLeave 
  

Posted
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.

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...