Eht1 Posted December 5, 2011 Share Posted December 5, 2011 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 ) Link to comment
Aibo Posted December 5, 2011 Share Posted December 5, 2011 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. Link to comment
unknooooown Posted December 5, 2011 Share Posted December 5, 2011 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) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now