Assistance on working on an addon - Which is a better method?

Hello All,

I’m wondering if anyone could help me with coming up with a method on creating my addon. I do have knowledge of gLua but the way to approach things and coming up doing things I lack of. The addon I’m wanting to create is Hotel Manager, the way the addon will function is when someone buys a door, every x seconds the hotel manager will receive x amount meaning he can set rent for each room.

I’m looking for the best method on which admins can add doors that can be rented. We only want admins to be able to set the door that are allowed to be rented. When an admin sets a door to be rented, that’ll then add it to a table.

This is what I’ve come up with below, is this approach a bad way to go?



hook.Add( "PlayerSay", "drp_AdminAddRentedDoor", function( ply, text )

local playerInput = string.Explode( " ", text );
local playerEyes =  ply:GetEyeTrace().Entity

if playerInput[1] == "/addRentedDoor" and ply:IsAdmin() and playerEyes:IsDoor() then

    if ( tonumber( playerInput[2] ) ) then

	local doorindex = playerEyes:EntIndex() -- We can do this because we checked above to see if it's a door.
			
	addDoor(doorindex, playerInput[2]) -- playerInput[2] is the default renting price we set buy doing /addRentedDoor 50, making rent $50 
			

        end
    end
end )

function addDoor(ent, price)

local defaultRent = price // The price we want the door to be from above ^
local door = ent // The unique door we grabbed from above ^


end




Anyone have any ideas on where I should go from here, or even making anything more better about this?

Help is much appreciated, thank you!