Jump to content

attempt to index local (a nil value)


..:D&G:..

Recommended Posts

When I start my house system, I get the error

attept to index local 'houseOwner' (a nil value)

-- Create houses 
function createHouse ( houseid, ownerid, interiorid, housex, housey, housez, housesale, houseprice, housename, houselocked, boughtprice, passwordlocked, housepassword ) 
    if ( housesale == 0 ) then 
        _G["house"..tostring(houseid)] = createPickup ( housex, housey, housez, 3, 1272, 0) 
    else 
        _G["house"..tostring(houseid)] = createPickup ( housex, housey, housez, 3, 1273, 0) 
    end 
     
    local house = _G["house"..tostring(houseid)] 
    local houseOwner = exports.DENmysql:querySingle( "SELECT * FROM accounts WHERE id = ?", tonumber(ownerid) ) 
     
    setElementData(house, "houseid", houseid) 
    setElementData(house, "ownername", houseOwner.username) 
    setElementData(house, "ownerid",  tonumber(ownerid)) 
    setElementData(house, "interiorid",  tonumber(interiorid)) 
    setElementData(house, "housesale",  tonumber(housesale)) 
    setElementData(house, "houseprice", tonumber(houseprice)) 
    setElementData(house, "housename", housename) 
    setElementData(house, "houselocked",  tonumber(houselocked)) 
    setElementData(house, "boughtprice",  tonumber(boughtprice)) 
    setElementData(house, "housepassword",  tonumber(housepassword)) 
    setElementData(house, "passwordlocked",  tonumber(passwordlocked)) 
end 

This is the line:

    setElementData(house, "ownername", houseOwner.username) 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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