FrameworkZ API Documentation - Code Examples

📋 On This Page

Code Examples

page

Networking Example

This example shows how to use FrameworkZ's networking system.

 if isServer() then
     function serverFunction(data)
         if not data.isoPlayer then return end
 
         local getSomeServerVal = "Test"
 
         return getSomeServerVal
     end
     FrameworkZ.Foundation:Subscribe("serverFunction", serverFunction)
 end
 
 if isClient() then
     function clientFunction(isoPlayer)
         FrameworkZ.Foundation:SendFire(isoPlayer, "serverFunction", function(data, retVal)
             data.isoPlayer:Say(retVal) -- Executes as soon as server responds, player says "Test"
         end)
     end
 
     clientFunction(getPlayer())
 end