Jump to content

gghvcffcv

Members
  • Posts

    139
  • Joined

  • Last visited

Everything posted by gghvcffcv

  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. gghvcffcv

    Database problem

    I created a folder with name of "Modules" and added it to mtaserver but still doesn't work
  11. 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
  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
  13. 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)
  14. if you come to this topic is to help let this job to the moderators, and it's not against the rules.
  15. I think your problem is in the meta you put type = Gamemode...
  16. When the player is outside of the Marker "HouseRob" it gives the money to the player anyways, Other thing the debugscript says me Line 20 getelementtype bad first argument How to solve this?... HouseRob = createMarker ( 2024.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) function Money(hitElement) if ( getElementType ( hitElement ) == "player" ) then local Criminals = getPlayerTeam ( hitElement ) if ( Criminals ) then if isElementWithinMarker(hitElement, HouseRob) then setTimer(givePlayerMoney,10000,1,hitElement, 10000) setTimer(setPlayerWantedLevel,10000,1,hitElement, 6) setTimer (destroyElement,10000,1,HouseRob) end end end end addEventHandler ("onMarkerHit", HouseRob, Money) function Otro(hitElement) if ( getElementType ( hitElement ) == "player" ) then HouseRobC = createMarker ( 2027.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) if (markerevent == nil) then markerevent = addEventHandler ("onMarkerHit", HouseRobC, Otro) end end end addEventHandler ("onElementDestroy", HouseRob, Otro) function Otro(hitElement) if ( getElementType ( hitElement ) == "player" ) then local Criminals = getPlayerTeam ( hitElement ) if ( Criminals ) then if isElementWithinMarker(hitElement, HouseRob) then setTimer(givePlayerMoney,30000,1,hitElement, 10000) setTimer(setPlayerWantedLevel,10000,1,hitElement, 6) setTimer (destroyElement,30000,1,HouseRobC) end end end end
  17. I can't do that because I need two event handler
  18. It says me addEventHandler argument 2 got nil Why this?. and how solve it?- local HouseRob = createMarker ( 2024.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) function Money(hElement) local Criminals = getPlayerTeam ( hElement ) if ( Criminals ) then setTimer(givePlayerMoney,60000,1,hElement, 10000) setTimer(setPlayerWantedLevel,60000,1,hElement, 6) setTimer (destroyElement,60000,1,HouseRob) end end addEventHandler ("onMarkerHit", HouseRob, Money) function Otro(hElement) HouseRobC = createMarker ( 2027.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) end addEventHandler ("onElementDestroy", HouseRob, Otro) function Otro(hElement) local Criminals = getPlayerTeam ( hElement ) if ( Criminals ) then setTimer(givePlayerMoney,60000,1,hElement, 10000) setTimer(setPlayerWantedLevel,60000,1,hElement, 6) setTimer (destroyElement,60000,1,HouseRobC) end end addEventHandler ("onMarkerHit", HouseRobC, Otro)
  19. But I want the marker give the money when the player is in the marker 1 Minute
  20. I have done this script but I don't know how to do to destroy the Marker "HouseRob" later a player is into it 1 Minute local HouseRob = createMarker ( 2024.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) function Destruir(hElement) if getElementType ( HouseRob ) == "marker" then destroyElement (HouseRob) triggerServerEvent ( "Destruyelo", localPlayer) end end addEventHandler ("onClientMarkerHit", HouseRob, Destruir) function Warehouse() Warehouse = createMarker ( 2040.5205078125, 1545.6474609375, 9.81995010376, "cylinder", 10, 255, 0, 0, 150) end addEventHandler ("onClientElementDestroy", HouseRob, Warehouse) function Money(hElement) givePlayerMoney (hElement, 6000) end addEventHandler ("onClientMarkerHit", Warehouse, Money)
×
×
  • Create New...