I've decided to some fun activities with my free time to make some fun addons for Garry's Mod, roleplay.
The addon I'm trying to make is allowing specific doors to be rentable, then when someone rents that door, the main owner will receive periodical payments!
I am having some issues with the table not being accessible though.
-- door is a meta function, a property to all entities. -- in this case it belongs to doors.
cRentableDoors = cRentableDoors or {} -- Global table
function door:makeRentableSub( doorParent )
-- GetNWBool() is a function used to network information
-- on entities from server to client. ( so we can draw HUDs etc )
if self:GetNWBool( "IsRentable" ) == false or nil then
self:SetNWBool( "IsRentable", true )
self:SetNWBool( "IsSub", true )
cRentableDoors[doorParent:MapCreationID()] = {
MainDoor = doorParent,
SubDoors = {{ent = self, key = self:MapCreationID()}}
}
end
end
There's just one issue. when i want to add a few sub doors, the 'SubDoors' table only prints 1 index. Am I overriding something here?
Feel free to ask any questions what you aren't sure about!
Thanks!