• Announcements

    • jhxp

      Forums are online again after a maintenance.   18/03/17

      MTA Forums maintenance is completed, although some automatic time-heavy tasks are still in process and will be finished eventually in background. Expect some features such as Forum Search to not display all results until all processes are finished. Please let us know if you spot a forum feature that worked correctly before the maintenance but does not work anymore now. Thanks. --MTA Team
    • jhxp

      Multi Theft Auto: San Andreas 1.5.4 is out!   21/04/17

      Click the link in the announcement for more details.  

gghvcffcv

Members
  • Content count

    141
  • Joined

  • Last visited

Community Reputation

0 Neutral

About gghvcffcv

  • Rank
    Poot-butt

Details

  • Gang
    None
  1. I think instead of _local you should put (source)
  2. the problems Is I have already some scripts with that database exports.database
  3. do you have skype? could you help me?
  4. I took this misc to connect some scripts with this database, https://community.multitheftauto.com/index.php?p=resources&s=details&id=546 I configured database.xml with phpmyadmin details, but it says connection closed or corrupted
  5. Hey thanks for your answer, How can I use dbconnect? I am using this misc to connect to database https://community.multitheftauto.com/index.php?p=resources&s=details&id=546
  6. When I go to Filezilla and paste mysql.so file in folder "Modules", it says me access denied... Could you please help me? Thanks for reading !
  7. I didn't steal them, I found them on internet. I didn't steal them, I found them on internet.
  8. Because I think it's with DB
  9. The problem is that I don't know what is giving the problem
  10. What code bro?
  11. I created a folder with name of "Modules" and added it to mtaserver but still doesn't work
  12. 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
  13. How bro