Talk:CallServerFunction
Jump to navigation
Jump to search
I would rather use this variant for both calling client and server functions..
[lua] -- client side addEvent("onServerRequest", true) addEventHandler("onServerRequest", rootElement, function (funcname, ...) _G[funcname](...) end ) -- server side addEvent("onClientRequest", true) addEventHandler("onClientRequest", rootElement, function (funcname, ...) _G[funcname](...) end ) -- and call them like triggerServerEvent("onClientRequest", rootElement, "changeResStateS", resource, state) -- while I have defined a function changeResStateS(resource, state) end on server side and vice versa.
LordAzamath 19:47, 14 May 2009 (CEST)