Jump to content

I need help with server side


Eht1

Recommended Posts

Posted

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 ) 

Posted

ok, where did you get this code then.

people who use OOP in Lua usually know stuff well enough not to ask for help here.

Posted

Either you are not showing us the entire script or you have NO idea what you are doing.

I dont know anything about OOP(Object Oriented Programming), but what you are doing looks very wrong.

Its a mix of client and serverside scripts... If you want to add all that serverside.. Weeell, then you should probably start by reading here: https://wiki.multitheftauto.com/wiki/Main_Page

"Somthing.onClientStart" does not exist anywhere either..

Also.. Please use [ lua ]CODE HERE [ /lua ] (without spaces)

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