function ableEnterCom(interior,dimension,type) 
  
function enterCom(message) 
    if(message == "!enter") then 
        getInterior = executeSQLSelect("interiors","*","id = '"..interior.."'") 
        local o=0 
        table.foreach(getInterior,function() o=o+1 end) 
        if(o~=0) then 
            setElementInterior(source,tonumber(getInterior[1]["interior"]),tonumber(getInterior[1]["x"]),tonumber(getInterior[1]["y"]),tonumber(getInterior[1]["z"])) 
            setElementDimension(source,tonumber(dimension)) 
            setElementData(source,"location",type) 
        else 
            outputConsole("Can't enter: ERROR 1",source) 
        end 
    end 
end 
  
addEventHandler("onPlayerChat",getRootElement(),enterCom) 
  
end 
  
function enterTo(entity) 
    if(getElementType(entity) == "player") then 
        if(isPedInVehicle(entity)) then 
            getEnter = executeSQLSelect("enters","*","enter_marker_id = '"..getElementID(source).."'") 
            local k=0 
            table.foreach(getEnter,function() k=k+1 end) 
            if(k~=0) then 
                ableEnterCom(getEnter[1]["interior"],getEnter[1]["dimension"],getEnter[1]["id"]) 
            end 
        end 
    end 
end 
  
addEventHandler("onMarkerHit",getRootElement(),enterTo) 
  
function quit(message) 
    if(message == "!exit") then 
    location = getElementData(source,"location") 
        if(location~="world") then 
            getWorld = executeSQLSelect("enters","*","id = '"..location.."'") 
            marker = getElementByID(getWorld[1]["enter_marker_id"]) 
            local x,y,z = getElementPosition(marker) 
            setElementInterior(source,0,x,y,z) 
            setElementDimension(source,0) 
            setElementData(source,"location","world") 
        end 
    end 
end 
  
addEventHandler("onPlayerChat",getRootElement(),quit)