Hi all,
what i need to add in server side if is:
function Somthing.onStart ()
triggerServerEvent ( "Somthing.onClientStart", localPlayer )
end
addEventHandler ( "onClientResourceStart", resourceRoot, Somthing.onStart )
function Somthing.onStop ()
for k, v in ipairs(instances) do
v:destruct ( false )
end
instances = {}
end
addEventHandler ( "onClientResourceStop", resourceRoot, Somthing.onStop )
function Somthing.get ( id )
for k, v in ipairs(instances) do
if ( v.id == id ) then return v end
end
return nil
end
function Somthing:rpc ( func, ... )
triggerServerEvent ( "Somthing.onRPC", localPlayer, self.id, func, unpack ( arg ) )
end
function Somthing.onRPC ( id, rpc, ... )
local self = Somthing.get ( id )
if ( self ) then
Somthing[rpc] ( self, unpack ( arg ) )
end
end
addEvent ( "Somthing.onRPC", true )
addEventHandler ( "Somthing.onRPC", root, Somthing.onRPC )