Piorun Posted January 19, 2016 Share Posted January 19, 2016 Guys, i need help. I have this code: function PoliceVehicle(model,position) local policeVeh = Element("policeVehicle") local vehicle = Vehicle(model,position) local PoliceVehicleMT = getmetatable(policeVeh) local VehicleMT = getmetatable(vehicle) PoliceVehicleMT.__parent = VehicleMT local PoliceVehicleClass = getmetatable(policeVeh).__class function PoliceVehicleClass:output() outputChatBox("test") end return policeVeh end which is contructor of PoliceVehicle class and i want to that class implement all methods from Vehicle class (and also if i for ex. write local police = PoliceVehicle(...) police:setPosition(Vector3(x,y,z)) I want to change that object position [also vehicle]). This code i shown doesn't work. Link to comment
Piorun Posted January 20, 2016 Author Share Posted January 20, 2016 Anyone can answer me is this possible? I mean full Inheritance is possible in MTA? I did it creating my own classes but i don't know struct of OOP in MTA (there are special metamethods like __set, __get, __parent wtf ..). 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