gghvcffcv Posted September 7, 2016 Share Posted September 7, 2016 I create the house and set interior but It doesn't enable enter button I don't know what to do could you help me? enterButton = guiCreateButton(21,17,99,29,"Enter",false,houseTab) if tonumber(houseData['interior']) > 0 and tonumber(houseData['interior']) < 25 and tonumber(houseData['intlock']) == 1 then guiSetEnabled(enterButton, true) else guiSetEnabled(enterButton, false) end infoMemo = guiCreateMemo(18,230,720,160,"Housing Help Will Be Here",false,houseTab) Link to comment
EstrategiaGTA Posted September 7, 2016 Share Posted September 7, 2016 Post your full housing system... We can't guess the problem out of 6 lines. To make a GUI element visible, use guiSetVisible. Link to comment
gghvcffcv Posted September 7, 2016 Author Share Posted September 7, 2016 (edited) function startResource() local houses = executeSQLQuery("SELECT * FROM `housingdata`") if #houses > 0 then for i,v in ipairs(houses) do local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) end end end addEventHandler("onResourceStart", resourceRoot, startResource) function commenceHousingDisplay(houseIcon) if isElement(houseIcon) then if getElementData(houseIcon, "isHouse") then local houseID = getElementData(houseIcon, "ID") local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id` = ?", houseID) if #houses == 1 then local houseData = houses[1] if tonumber(houseData['type']) == 2 or houseData['owner'] == getAccountName(getPlayerAccount(source)) then local vehicles = getVehicles(source) local weapons = getWeapons(source) if vehicles and weapons then triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, vehicles, weapons) else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else exports.SARScommands:sendMessage("*SARS Housing* An unexpected error occured. Please contact the HQ team with error number 1.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end end addEvent("onCommenceHousingDisplay", true) addEventHandler("onCommenceHousingDisplay", root, commenceHousingDisplay) function startHouseSale(houseData, price) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(price) and tonumber(houseData['status']) == 0 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then price = tonumber(price) local lowerPrice = tonumber(houseData['value']) * 0.90 local upperPrice = tonumber(houseData['value']) * 1.10 if price >= lowerPrice and price <= upperPrice then executeSQLQuery("UPDATE `housingdata` SET `status`=1, `price`=? WHERE `id`=?", price, houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House put on sale successfully.", 0, 255, 0, source) end end end end end function stopHouseSale(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then if tonumber(houseData['value']) then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `price`=? WHERE `id`=?", tonumber(houseData['value']), houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House removed from sale successfully.", 0, 255, 0, source) end end end end end function buyHouse(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) local housedata2 = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(houseData['id'])) if housedata2 and #housedata2 == 1 and housedata2['owner'] ~= username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then local price = tonumber(houseData['price']) if price then if exports.SARSbanking:getPlayerBankBalance(source) >= price then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `value`=?, `owner`=? WHERE `id`=?", price, username, houseID) local buyerMoney = exports.SARSbanking:getPlayerBankBalance(source) local buyerNewMoney = buyerMoney - price exports.SARSbanking:setPlayerBankBalance(source, buyerNewMoney) local buyerHouses = getAccountData(getPlayerAccount(source), "houses") or "" local buyerHouseArray = split(buyerHouses, ",") or {} table.insert(buyerHouseArray, houseID) local newbuyerHouses = db:escapeString(table.concat(buyerHouseArray, ",")) setAccountData(getPlayerAccount(source), "houses", newbuyerHouses) if houseData['owner'] ~= "SAHousing" then if houseData['owner'] ~= "SkyRealEstate" then local ownerAccount = getAccount(houseData['owner']) if ownerAccount then local ownerMoney = exports.SARSbanking:getAccountBankBalance(houseData['owner']) local ownerNewMoney = tonumber(ownerMoney) + price exports.SARSbanking:setAccountBankBalance(houseData['owner'], ownerNewMoney) local ownerHouses = getAccountData(ownerAccount, "houses") or "" local ownerHouseArray = split(ownerHouses, ",") or {} for i,v in ipairs(ownerHouseArray) do if tonumber(v) == tonumber(houseID) then table.remove(ownerHouseArray, i) break end end local newOwnerHouses = db:escapeString(table.concat(ownerHouseArray, ",")) setAccountData(ownerAccount, "houses", newOwnerHouses) end else local sky = executeSQLQuery("SELECT amount FROM businessaccounts WHERE name='skyint'") executeSQLQuery("UPDATE businessaccounts SET amount=? WHERE name='skyint'", sky[1].amount + price) end end recacheHouse(houseID) exports.SARScommands:sendMessage("*Housing* Congratulations, you've bought the house!", 0, 255, 0, source) triggerClientEvent(source, "closeHousingGUI", root) end end end end end end addEvent("onPlayerStartHouseSale", true) addEvent("onPlayerStopHouseSale", true) addEvent("onPlayerBuyHouse", true) addEventHandler("onPlayerStartHouseSale", root, startHouseSale) addEventHandler("onPlayerStopHouseSale", root, stopHouseSale) addEventHandler("onPlayerBuyHouse", root, buyHouse) --Export function recacheHouse(id) if not tonumber(id) then return false end if getElementByID("housing"..tonumber(id)) then destroyElement(getElementByID("housing"..tonumber(id))) end local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(id)) if #houses == 1 then local v = houses[1] local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) return true end return false end -- Export function getAccountHouses(account) if account and getAccountName(account) then local accountName = getAccountName(account) local returnTable = {} local query = executeSQLQuery("SELECT * FROM housingdata WHERE `owner`=?", accountName) for i,data in ipairs(query) do local x = data.x local y = data.y local z = data.z local name = data.name .. ", " .. data.address table.insert(returnTable, {name, x, y, z}) end return returnTable else return false end end Edited September 7, 2016 by Tete omar Lua tag Link to comment
aka Blue Posted September 7, 2016 Share Posted September 7, 2016 Please use Lua code tag. Link to comment
Mr.Aleks Posted September 7, 2016 Share Posted September 7, 2016 2 hours ago, aka Blue said: Incredibly well explained Link to comment
GTX Posted September 7, 2016 Share Posted September 7, 2016 Is your interior locked? Intlock in your database should be set to 1 as far as I can see. Link to comment
gghvcffcv Posted September 7, 2016 Author Share Posted September 7, 2016 (edited) function startResource() local houses = executeSQLQuery("SELECT * FROM `housingdata`") if #houses > 0 then for i,v in ipairs(houses) do local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) end end end addEventHandler("onResourceStart", resourceRoot, startResource) function commenceHousingDisplay(houseIcon) if isElement(houseIcon) then if getElementData(houseIcon, "isHouse") then local houseID = getElementData(houseIcon, "ID") local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id` = ?", houseID) if #houses == 1 then local houseData = houses[1] if tonumber(houseData['type']) == 2 or houseData['owner'] == getAccountName(getPlayerAccount(source)) then local vehicles = getVehicles(source) local weapons = getWeapons(source) if vehicles and weapons then triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, vehicles, weapons) else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else exports.SARScommands:sendMessage("*SARS Housing* An unexpected error occured. Please contact the HQ team with error number 1.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end end addEvent("onCommenceHousingDisplay", true) addEventHandler("onCommenceHousingDisplay", root, commenceHousingDisplay) function startHouseSale(houseData, price) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(price) and tonumber(houseData['status']) == 0 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then price = tonumber(price) local lowerPrice = tonumber(houseData['value']) * 0.90 local upperPrice = tonumber(houseData['value']) * 1.10 if price >= lowerPrice and price <= upperPrice then executeSQLQuery("UPDATE `housingdata` SET `status`=1, `price`=? WHERE `id`=?", price, houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House put on sale successfully.", 0, 255, 0, source) end end end end end function stopHouseSale(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then if tonumber(houseData['value']) then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `price`=? WHERE `id`=?", tonumber(houseData['value']), houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House removed from sale successfully.", 0, 255, 0, source) end end end end end function buyHouse(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) local housedata2 = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(houseData['id'])) if housedata2 and #housedata2 == 1 and housedata2['owner'] ~= username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then local price = tonumber(houseData['price']) if price then if exports.SARSbanking:getPlayerBankBalance(source) >= price then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `value`=?, `owner`=? WHERE `id`=?", price, username, houseID) local buyerMoney = exports.SARSbanking:getPlayerBankBalance(source) local buyerNewMoney = buyerMoney - price exports.SARSbanking:setPlayerBankBalance(source, buyerNewMoney) local buyerHouses = getAccountData(getPlayerAccount(source), "houses") or "" local buyerHouseArray = split(buyerHouses, ",") or {} table.insert(buyerHouseArray, houseID) local newbuyerHouses = db:escapeString(table.concat(buyerHouseArray, ",")) setAccountData(getPlayerAccount(source), "houses", newbuyerHouses) if houseData['owner'] ~= "SAHousing" then if houseData['owner'] ~= "SkyRealEstate" then local ownerAccount = getAccount(houseData['owner']) if ownerAccount then local ownerMoney = exports.SARSbanking:getAccountBankBalance(houseData['owner']) local ownerNewMoney = tonumber(ownerMoney) + price exports.SARSbanking:setAccountBankBalance(houseData['owner'], ownerNewMoney) local ownerHouses = getAccountData(ownerAccount, "houses") or "" local ownerHouseArray = split(ownerHouses, ",") or {} for i,v in ipairs(ownerHouseArray) do if tonumber(v) == tonumber(houseID) then table.remove(ownerHouseArray, i) break end end local newOwnerHouses = db:escapeString(table.concat(ownerHouseArray, ",")) setAccountData(ownerAccount, "houses", newOwnerHouses) end else local sky = executeSQLQuery("SELECT amount FROM businessaccounts WHERE name='skyint'") executeSQLQuery("UPDATE businessaccounts SET amount=? WHERE name='skyint'", sky[1].amount + price) end end recacheHouse(houseID) exports.SARScommands:sendMessage("*Housing* Congratulations, you've bought the house!", 0, 255, 0, source) triggerClientEvent(source, "closeHousingGUI", root) end end end end end end addEvent("onPlayerStartHouseSale", true) addEvent("onPlayerStopHouseSale", true) addEvent("onPlayerBuyHouse", true) addEventHandler("onPlayerStartHouseSale", root, startHouseSale) addEventHandler("onPlayerStopHouseSale", root, stopHouseSale) addEventHandler("onPlayerBuyHouse", root, buyHouse) --Export function recacheHouse(id) if not tonumber(id) then return false end if getElementByID("housing"..tonumber(id)) then destroyElement(getElementByID("housing"..tonumber(id))) end local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(id)) if #houses == 1 then local v = houses[1] local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) return true end return false end -- Export function getAccountHouses(account) if account and getAccountName(account) then local accountName = getAccountName(account) local returnTable = {} local query = executeSQLQuery("SELECT * FROM housingdata WHERE `owner`=?", accountName) for i,data in ipairs(query) do local x = data.x local y = data.y local z = data.z local name = data.name .. ", " .. data.address table.insert(returnTable, {name, x, y, z}) end return returnTable else return false end end No my internet is not locked Edited September 7, 2016 by gghvcffcv Link to comment
Syntrax# Posted September 7, 2016 Share Posted September 7, 2016 5 minutes ago, gghvcffcv said: function startResource() local houses = executeSQLQuery("SELECT * FROM `housingdata`") if #houses > 0 then for i,v in ipairs(houses) do local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) end end end addEventHandler("onResourceStart", resourceRoot, startResource) function commenceHousingDisplay(houseIcon) if isElement(houseIcon) then if getElementData(houseIcon, "isHouse") then local houseID = getElementData(houseIcon, "ID") local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id` = ?", houseID) if #houses == 1 then local houseData = houses[1] if tonumber(houseData['type']) == 2 or houseData['owner'] == getAccountName(getPlayerAccount(source)) then local vehicles = getVehicles(source) local weapons = getWeapons(source) if vehicles and weapons then triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, vehicles, weapons) else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else triggerClientEvent(source, "onDisplayHousingMenu", houseIcon, houseData, false, false) end else exports.SARScommands:sendMessage("*SARS Housing* An unexpected error occured. Please contact the HQ team with error number 1.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end else exports.SARScommands:sendMessage("*SARS Housing* An error occured. Please contact the HQ team with the error code 2.",255,0,0, source) end end addEvent("onCommenceHousingDisplay", true) addEventHandler("onCommenceHousingDisplay", root, commenceHousingDisplay) function startHouseSale(houseData, price) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(price) and tonumber(houseData['status']) == 0 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then price = tonumber(price) local lowerPrice = tonumber(houseData['value']) * 0.90 local upperPrice = tonumber(houseData['value']) * 1.10 if price >= lowerPrice and price <= upperPrice then executeSQLQuery("UPDATE `housingdata` SET `status`=1, `price`=? WHERE `id`=?", price, houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House put on sale successfully.", 0, 255, 0, source) end end end end end function stopHouseSale(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) if houseData['owner'] == username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then if tonumber(houseData['value']) then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `price`=? WHERE `id`=?", tonumber(houseData['value']), houseID) recacheHouse(houseID) triggerClientEvent(source, "closeHousingGUI", root) exports.SARScommands:sendMessage("*Housing* House removed from sale successfully.", 0, 255, 0, source) end end end end end function buyHouse(houseData) if source and getAccountName(getPlayerAccount(source)) then local username = getAccountName(getPlayerAccount(source)) local housedata2 = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(houseData['id'])) if housedata2 and #housedata2 == 1 and housedata2['owner'] ~= username and tonumber(houseData['id']) and tonumber(houseData['status']) == 1 then local houseID = tonumber(houseData['id']) local houseIcon = getElementByID("housing"..houseID) if houseIcon then local price = tonumber(houseData['price']) if price then if exports.SARSbanking:getPlayerBankBalance(source) >= price then executeSQLQuery("UPDATE `housingdata` SET `status`=0, `value`=?, `owner`=? WHERE `id`=?", price, username, houseID) local buyerMoney = exports.SARSbanking:getPlayerBankBalance(source) local buyerNewMoney = buyerMoney - price exports.SARSbanking:setPlayerBankBalance(source, buyerNewMoney) local buyerHouses = getAccountData(getPlayerAccount(source), "houses") or "" local buyerHouseArray = split(buyerHouses, ",") or {} table.insert(buyerHouseArray, houseID) local newbuyerHouses = db:escapeString(table.concat(buyerHouseArray, ",")) setAccountData(getPlayerAccount(source), "houses", newbuyerHouses) if houseData['owner'] ~= "SAHousing" then if houseData['owner'] ~= "SkyRealEstate" then local ownerAccount = getAccount(houseData['owner']) if ownerAccount then local ownerMoney = exports.SARSbanking:getAccountBankBalance(houseData['owner']) local ownerNewMoney = tonumber(ownerMoney) + price exports.SARSbanking:setAccountBankBalance(houseData['owner'], ownerNewMoney) local ownerHouses = getAccountData(ownerAccount, "houses") or "" local ownerHouseArray = split(ownerHouses, ",") or {} for i,v in ipairs(ownerHouseArray) do if tonumber(v) == tonumber(houseID) then table.remove(ownerHouseArray, i) break end end local newOwnerHouses = db:escapeString(table.concat(ownerHouseArray, ",")) setAccountData(ownerAccount, "houses", newOwnerHouses) end else local sky = executeSQLQuery("SELECT amount FROM businessaccounts WHERE name='skyint'") executeSQLQuery("UPDATE businessaccounts SET amount=? WHERE name='skyint'", sky[1].amount + price) end end recacheHouse(houseID) exports.SARScommands:sendMessage("*Housing* Congratulations, you've bought the house!", 0, 255, 0, source) triggerClientEvent(source, "closeHousingGUI", root) end end end end end end addEvent("onPlayerStartHouseSale", true) addEvent("onPlayerStopHouseSale", true) addEvent("onPlayerBuyHouse", true) addEventHandler("onPlayerStartHouseSale", root, startHouseSale) addEventHandler("onPlayerStopHouseSale", root, stopHouseSale) addEventHandler("onPlayerBuyHouse", root, buyHouse) --Export function recacheHouse(id) if not tonumber(id) then return false end if getElementByID("housing"..tonumber(id)) then destroyElement(getElementByID("housing"..tonumber(id))) end local houses = executeSQLQuery("SELECT * FROM `housingdata` WHERE `id`=?", tonumber(id)) if #houses == 1 then local v = houses[1] local houseIcon if tonumber(v['type']) == 2 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1277, 0) createBlipAttachedTo(houseIcon, 35, 2, 0, 0, 0, 255, 0, 250, getRootElement()) elseif tonumber(v['type']) == 1 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end elseif tonumber(v['type']) == 0 then if tonumber(v['status']) == 0 then houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1272, 0) else houseIcon = createPickup(v['x'], v['y'], v['z'], 3, 1273, 0) end end setElementID(houseIcon, "housing"..v['id']) setElementData(houseIcon, "isHouse", true) setElementData(houseIcon, "ID", v['id']) return true end return false end -- Export function getAccountHouses(account) if account and getAccountName(account) then local accountName = getAccountName(account) local returnTable = {} local query = executeSQLQuery("SELECT * FROM housingdata WHERE `owner`=?", accountName) for i,data in ipairs(query) do local x = data.x local y = data.y local z = data.z local name = data.name .. ", " .. data.address table.insert(returnTable, {name, x, y, z}) end return returnTable else return false end end No my internet is not locked Sorry but i don't think the mta community accept to help to fix leaked scripts. Especially the leaked WSS housing. 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now