Jump to content

attempt to index field '?' (a nil value)


kecskebeka

Recommended Posts

Hy, please help.

function enterInterior(dim,withFront,intTypeID)
    local veh = getPedOccupiedVehicle(source)    
    if not veh then
        setElementPosition(source, tonumber(interiors[intTypeID][2]),tonumber(interiors[intTypeID][3]),tonumber(interiors[intTypeID][4]))
        setElementInterior(source, interiors[intTypeID][1])
        setElementDimension(source, dim)
    end
end
addEvent("enterInterior", true)
addEventHandler("enterInterior", getRootElement(), enterInterior)

Link to comment
setElementPosition(source, tonumber(interiors[intTypeID][2]),tonumber(interiors[intTypeID][3]),tonumber(interiors[intTypeID][4]))
setElementInterior(source, interiors[intTypeID][1])

You're attempting to index the table interiors which is undefined, that is, a 'nil' value. You should define the table first, through something like this 

interiors = {
  [1] = {interiorWorldID, posX, posY, posZ}, -- of couse, substitute interiorWoldID, posX, posY, posZ with actual values
  [2] = {interiorWorldID, posX, posY, posZ},
  [3] = {interiorWorldID, posX, posY, posZ},
}

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...