terreus Posted March 28, 2015 Share Posted March 28, 2015 (edited) -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" هذااا كود حق قاعدة بيانات البيوت بس أقدر أسويه بدون كل ذول أعرف قاعدة بيانات حق المنتدي او مواقع الخ... بس أبيكم تفهموني كيف أسويه في سيرفري او سيرفري تجربي Edited March 28, 2015 by Guest Link to comment
</Mr.Tn6eL> Posted March 28, 2015 Share Posted March 28, 2015 ‘ iмя.єтι-кєт 亗 said: -- Here you can change some settings ---- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" هذااا كود حق قاعدة بيانات البيوت بس أقدر أسويه بدون كل ذول أعرف قاعدة بيانات حق المنتدي او مواقع الخ... بس أبيكم تفهموني كيف أسويه في سيرفري او سيرفري تجربي والله مني فاهم وضح الطلب لأن في نوعين من قواعد البيانات sqlite mysql الموجود عندك mysql على السيرفر المحلي روح حمل السيرفر المحلي وادخل الphpmyadmin وسوي القاعدة البيانات Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 Mr.Tn6eL said: ‘ iмя.єтι-кєт 亗 said: -- Here you can change some settings ---- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" هذااا كود حق قاعدة بيانات البيوت بس أقدر أسويه بدون كل ذول أعرف قاعدة بيانات حق المنتدي او مواقع الخ... بس أبيكم تفهموني كيف أسويه في سيرفري او سيرفري تجربي والله مني فاهم وضح الطلب لأن في نوعين من قواعد البيانات sqlite mysql الموجود عندك mysql على السيرفر المحلي روح حمل السيرفر المحلي وادخل الphpmyadmin وسوي القاعدة البيانات عندي مود بيوت مسويه واحد أجنبي ومسوي قاعدة بايانات زي موضوع بس انا أبي أحذف قاعدة البيانات من المود وأرجعه يحفض SQL زي مود البيووت العادي Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 شوفو مشكله عندما أركب مود بدون أي تعديل مشكله يضهر أف 8 / [06:44:52] start: Requested [06:44:52] Starting housesystem [06:44:53] ERROR: housesystem\server.lua:92: dbConnect failed; Can't connect to MySQL server on 'localhost' (10061) [06:44:53] [HOUSESYSTEM]MySQL handler 1 not accepted! Trying secondary handler... [06:44:54] ERROR: housesystem\server.lua:97: dbConnect failed; Can't connect to MySQL server on 'localhost' (10061) [06:44:54] [HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down... [06:44:54] Start up of resource housesystem cancelled by script [06:44:54] Stopping housesystem start: Resource 'housesystem' start was requested (Start up of resource cancelled by script) يعني أن لم يتصل بي قاعدة بيانات زي PhpAdmin هذه مشكله Link to comment
</Mr.Tn6eL> Posted March 28, 2015 Share Posted March 28, 2015 حط ملف السيرفر الخاص بمود البيوت Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 -- MySQL Housesystem created & released by Noneatme(MuLTi), Do not remove credits! -- -- All Rights go to Noneatme -- --[[ Total time token: - 3 hour - 1.5 hour ________ 4.5 hours ]] ------------------------ -- CONNECTION HANDLER -- ------------------------ -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" local dbpTime = 500 -- How many Miliseconds will use the dbPoll function for waiting for a result local max_player_houses = 2 -- Define the buyable houses per player local sellhouse_value = 80 -- The ammount in percent that you get back if you sell a house local open_key = "F5" -- Define the key for the infomenue and the housepanel -- I don't know whats the right time for that -- ----------------------------------------------------------------- -- IF YOU CAN'T WRITE IN LUA, DO NOT EDIT ANYTHING ABOVE HERE! -- ----------------------------------------------------------------- -- EVENTS -- addEvent("onHouseSystemHouseCreate", true) addEvent("onHouseSystemHouseLock", true) addEvent("onHouseSystemHouseDeposit", true) addEvent("onHouseSystemHouseWithdraw", true) addEvent("onHouseSystemWeaponDeposit", true) addEvent("onHouseSystemWeaponWithdraw", true) addEvent("onHouseSystemRentableSwitch", true) addEvent("onHouseSystemRentalprice", true) addEvent("onHouseSystemTenandRemove", true) addEvent("onHouseSystemInfoBuy", true) addEvent("onHouseSystemInfoRent", true) addEvent("onHouseSystemInfoEnter", true) local handler -- local only, we don't need a global handler local saveableValues = { ["MONEY"] = "MONEY", ["WEAP1"] = "WEAP1", ["WEAP2"] = "WEAP2", ["WEAP3"] = "WEAP3", ["LOCKED"] = "LOCKED", ["OWNER"] = "OWNER", ["RENTABLE"] = "RENTABLE", ["RENTALPRICE"] = "RENTALPRICE", ["RENT1"] = "RENT1", ["RENT2"] = "RENT2", ["RENT3"] = "RENT3", ["RENT4"] = "RENT4", ["RENT5"] = "RENT5", } local created = false -- DONT EDIT local houseid = 0 -- Define the Houseid, local house = {} -- The House array local houseData = {} -- The House Data arry local houseInt = {} -- The House Interior array local houseIntData = {} -- The House Interior Data Array local buildStartTick local buildEndTick local rentTimer -- STARTUP EVENT HANDLER -- addEventHandler("onResourceStart", getResourceRootElement(), function() handler = dbConnect("mysql", "dbname="..mysqldatabase1..";host="..mysqlhost1, mysqluser1, mysqlpassword1, "autoreconnect=1") -- If the Handler 1 dont work if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 1 not accepted! Trying secondary handler...") handler = dbConnect("mysql", "dbname="..mysqldatabase2..";host="..mysqlhost2, mysqluser2, mysqlpassword2, "autoreconnect=1") if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down...") cancelEvent() else outputServerLog("[HOUSESYSTEM]MySQL handler 2 accepted!") housesys_startup() end else outputServerLog("[HOUSESYSTEM]MySQL handler 1 accepted!") housesys_startup() end end) -- SHUTDOWN EVENT HANDLER -- addEventHandler("onResourceStop", getResourceRootElement(), function() -- Free the arrays -- for index, houses in pairs(house) do houses = nil end for index, houseDatas in pairs(houseData) do houseDatas = nil end for index, houseInts in pairs(houseInt) do houseInts = nil end for index, houseIntDatas in pairs(houseIntData) do houseIntDatas = nil end houseid = 0 created = false end) -------------- -- COMMANDS -- -------------- -- /unrent -- addCommandHandler("unrent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(isPlayerRentedHouse(thePlayer, id) == false) then outputChatBox("You are not tenad of this house!", thePlayer, 255, 0, 0) return end local sucess = removeHouseTenand(id, thePlayer) if(sucess == true) then outputChatBox("You have sucessfull terminate the tenancy!", thePlayer, 0, 255, 0) else outputChatBox("An error occurred!", thePlayer, 255, 0, 0) end end end) -- /rent -- addCommandHandler("rent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) then outputChatBox("You can't rent here! It's your house!", thePlayer, 255, 0, 0) return end if(tonumber(houseData[id]["RENTABLE"]) ~= 1) then outputChatBox("This house is not rentable!", thePlayer, 255, 0, 0) return end if(getPlayerRentedHouse(thePlayer) ~= false) then outputChatBox("You are allready a tenand in a house! Use /unrent first.", thePlayer, 255, 0, 0) return end local sucess = addHouseTenand(thePlayer, id) if(sucess == true) then outputChatBox("You are now tenand this house!", thePlayer, 0, 255, 0) else outputChatBox("You can't rent this house!", thePlayer, 255, 0, 0) end end end) -- /createhouse -- addCommandHandler("createhouse", function(thePlayer) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then if(getElementInterior(thePlayer) ~= 0) then outputChatBox("You are not outside!", thePlayer, 255, 0, 0) return end if(isPedInVehicle(thePlayer) == true) then outputChatBox("Please exit your vehicle.", thePlayer, 255, 0, 0) return end -- INSERT SECURITY OPTIONS LIKE ADMINLEVEL HERE( if(adminlevel > shit) then ...) triggerClientEvent(thePlayer, "onClientHouseSystemGUIStart", thePlayer) else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /in -- addCommandHandler("in", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = tonumber(house) if(tonumber(houseData[id]["LOCKED"]) == 0) or (houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then local int, intx, inty, intz, dim = houseIntData[id]["INT"], houseIntData[id]["X"], houseIntData[id]["Y"], houseIntData[id]["Z"], id setElementData(thePlayer, "house:in", true) setInPosition(thePlayer, intx, inty, intz, int, false, dim) unbindKey(thePlayer, open_key, "down", togglePlayerInfomenue, id) setElementData(thePlayer, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then bindKey(thePlayer, open_key, "down", togglePlayerHousemenue, id) end else outputChatBox("You don't have the housekey for this House!", thePlayer, 255, 0, 0) end end end end) -- /out -- addCommandHandler("out", function(thePlayer) if(getElementData(thePlayer, "house:lastvisitINT")) and (getElementData(thePlayer, "house:lastvisitINT") ~= false) then local house = getElementData(thePlayer, "house:lastvisitINT") if(house) then local id = tonumber(house) local x, y, z = houseData[id]["X"], houseData[id]["Y"], houseData[id]["Z"] setElementData(thePlayer, "house:in", false) setInPosition(thePlayer, x, y, z, 0, false, 0) end end end) -- /buyhouse -- addCommandHandler("buyhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= "no-one") then outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) else local houses = 0 for index, col in pairs(getElementsByType("colshape")) do if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then houses = houses+1 if(houses == max_player_houses) then Link to comment
</Mr.Tn6eL> Posted March 28, 2015 Share Posted March 28, 2015 عدلت لك الكود خليته على sqlite بس فيه مشكلة ماعرفت اسماء الكولمن column الخاصة بقاعدة البيانات عشان كذا مقدر اكملة لو تقدر تحط رابط السكربت عشان اشوف Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 Mr.Tn6eL said: عدلت لك الكود خليته على sqliteبس فيه مشكلة ماعرفت اسماء الكولمن column الخاصة بقاعدة البيانات عشان كذا مقدر اكملة لو تقدر تحط رابط السكربت عشان اشوف تم رفعه تفضل - http://www.up-00.com/?nfRq Link to comment
</Mr.Tn6eL> Posted March 28, 2015 Share Posted March 28, 2015 ‘ iмя.єтι-кєт 亗 said: Mr.Tn6eL said: عدلت لك الكود خليته على sqliteبس فيه مشكلة ماعرفت اسماء الكولمن column الخاصة بقاعدة البيانات عشان كذا مقدر اكملة لو تقدر تحط رابط السكربت عشان اشوف تم رفعه تفضل - http://www.up-00.com/?nfRq معليش نسيت اقلك ابي رابطه من المكان اللي حملته عشان اشوف معلومات اكثر عن المود واكمله لك + يلا اشوفك لما اصحي Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 Mr.Tn6eL said: ‘ iмя.єтι-кєт 亗 said: Mr.Tn6eL said: عدلت لك الكود خليته على sqliteبس فيه مشكلة ماعرفت اسماء الكولمن column الخاصة بقاعدة البيانات عشان كذا مقدر اكملة لو تقدر تحط رابط السكربت عشان اشوف تم رفعه تفضل - http://www.up-00.com/?nfRq معليش نسيت اقلك ابي رابطه من المكان اللي حملته عشان اشوف معلومات اكثر عن المود واكمله لك + يلا اشوفك لما اصحي تفضل : https://community.multitheftauto.com/index.php?p= ... ls&id=5228 / أضرب نفسك صفعة تصحي Link to comment
</Mr.Tn6eL> Posted March 28, 2015 Share Posted March 28, 2015 -- MySQL Housesystem created & released by Noneatme(MuLTi), Do not remove credits! -- -- All Rights go to Noneatme -- --[[ Total time token: - 3 hour - 1.5 hour ________ 4.5 hours ]] ------------------------ -- CONNECTION HANDLER -- ------------------------ -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" local dbpTime = 500 -- How many Miliseconds will use the dbPoll function for waiting for a result local max_player_houses = 2 -- Define the buyable houses per player local sellhouse_value = 80 -- The ammount in percent that you get back if you sell a house local open_key = "F5" -- Define the key for the infomenue and the housepanel -- I don't know whats the right time for that -- ----------------------------------------------------------------- -- IF YOU CAN'T WRITE IN LUA, DO NOT EDIT ANYTHING ABOVE HERE! -- ----------------------------------------------------------------- -- EVENTS -- addEvent("onHouseSystemHouseCreate", true) addEvent("onHouseSystemHouseLock", true) addEvent("onHouseSystemHouseDeposit", true) addEvent("onHouseSystemHouseWithdraw", true) addEvent("onHouseSystemWeaponDeposit", true) addEvent("onHouseSystemWeaponWithdraw", true) addEvent("onHouseSystemRentableSwitch", true) addEvent("onHouseSystemRentalprice", true) addEvent("onHouseSystemTenandRemove", true) addEvent("onHouseSystemInfoBuy", true) addEvent("onHouseSystemInfoRent", true) addEvent("onHouseSystemInfoEnter", true) local handler -- local only, we don't need a global handler local saveableValues = { ["MONEY"] = "MONEY", ["WEAP1"] = "WEAP1", ["WEAP2"] = "WEAP2", ["WEAP3"] = "WEAP3", ["LOCKED"] = "LOCKED", ["OWNER"] = "OWNER", ["RENTABLE"] = "RENTABLE", ["RENTALPRICE"] = "RENTALPRICE", ["RENT1"] = "RENT1", ["RENT2"] = "RENT2", ["RENT3"] = "RENT3", ["RENT4"] = "RENT4", ["RENT5"] = "RENT5", } local created = false -- DONT EDIT local houseid = 0 -- Define the Houseid, local house = {} -- The House array local houseData = {} -- The House Data arry local houseInt = {} -- The House Interior array local houseIntData = {} -- The House Interior Data Array local buildStartTick local buildEndTick local rentTimer -- STARTUP EVENT HANDLER -- addEventHandler("onResourceStart", getResourceRootElement(), function() handler = dbConnect("sqlite", ".sql files/FOR EXISTING DATABASES/execute_this.sql") -- If the Handler 1 dont work if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down...") cancelEvent() else outputServerLog("[HOUSESYSTEM]MySQL handler 1 accepted!") housesys_startup() end end) -- SHUTDOWN EVENT HANDLER -- addEventHandler("onResourceStop", getResourceRootElement(), function() -- Free the arrays -- for index, houses in pairs(house) do houses = nil end for index, houseDatas in pairs(houseData) do houseDatas = nil end for index, houseInts in pairs(houseInt) do houseInts = nil end for index, houseIntDatas in pairs(houseIntData) do houseIntDatas = nil end houseid = 0 created = false end) -------------- -- COMMANDS -- -------------- -- /unrent -- addCommandHandler("unrent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(isPlayerRentedHouse(thePlayer, id) == false) then outputChatBox("You are not tenad of this house!", thePlayer, 255, 0, 0) return end local sucess = removeHouseTenand(id, thePlayer) if(sucess == true) then outputChatBox("You have sucessfull terminate the tenancy!", thePlayer, 0, 255, 0) else outputChatBox("An error occurred!", thePlayer, 255, 0, 0) end end end) -- /rent -- addCommandHandler("rent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) then outputChatBox("You can't rent here! It's your house!", thePlayer, 255, 0, 0) return end if(tonumber(houseData[id]["RENTABLE"]) ~= 1) then outputChatBox("This house is not rentable!", thePlayer, 255, 0, 0) return end if(getPlayerRentedHouse(thePlayer) ~= false) then outputChatBox("You are allready a tenand in a house! Use /unrent first.", thePlayer, 255, 0, 0) return end local sucess = addHouseTenand(thePlayer, id) if(sucess == true) then outputChatBox("You are now tenand this house!", thePlayer, 0, 255, 0) else outputChatBox("You can't rent this house!", thePlayer, 255, 0, 0) end end end) -- /createhouse -- addCommandHandler("createhouse", function(thePlayer) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then if(getElementInterior(thePlayer) ~= 0) then outputChatBox("You are not outside!", thePlayer, 255, 0, 0) return end if(isPedInVehicle(thePlayer) == true) then outputChatBox("Please exit your vehicle.", thePlayer, 255, 0, 0) return end -- INSERT SECURITY OPTIONS LIKE ADMINLEVEL HERE( if(adminlevel > shit) then ...) triggerClientEvent(thePlayer, "onClientHouseSystemGUIStart", thePlayer) else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /in -- addCommandHandler("in", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = tonumber(house) if(tonumber(houseData[id]["LOCKED"]) == 0) or (houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then local int, intx, inty, intz, dim = houseIntData[id]["INT"], houseIntData[id]["X"], houseIntData[id]["Y"], houseIntData[id]["Z"], id setElementData(thePlayer, "house:in", true) setInPosition(thePlayer, intx, inty, intz, int, false, dim) unbindKey(thePlayer, open_key, "down", togglePlayerInfomenue, id) setElementData(thePlayer, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then bindKey(thePlayer, open_key, "down", togglePlayerHousemenue, id) end else outputChatBox("You don't have the housekey for this House!", thePlayer, 255, 0, 0) end end end end) -- /out -- addCommandHandler("out", function(thePlayer) if(getElementData(thePlayer, "house:lastvisitINT")) and (getElementData(thePlayer, "house:lastvisitINT") ~= false) then local house = getElementData(thePlayer, "house:lastvisitINT") if(house) then local id = tonumber(house) local x, y, z = houseData[id]["X"], houseData[id]["Y"], houseData[id]["Z"] setElementData(thePlayer, "house:in", false) setInPosition(thePlayer, x, y, z, 0, false, 0) end end end) -- /buyhouse -- addCommandHandler("buyhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= "no-one") then outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) else local houses = 0 for index, col in pairs(getElementsByType("colshape")) do if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then houses = houses+1 if(houses == max_player_houses) then outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) return end end end local money = getPlayerMoney(thePlayer) local price = houseData[id]["PRICE"] if(money < price) then outputChatBox("You have not enought money! You need "..(price-money).."$ more!", thePlayer, 255, 0, 0) return end setHouseData(id, "OWNER", Link to comment
terreus Posted March 28, 2015 Author Share Posted March 28, 2015 [10:41:28] start: Requested [10:41:28] Resource 'housesystem' changed, reloading and starting [10:41:30] Starting housesystem [10:41:30] [HOUSESYSTEM]MySQL handler 1 accepted! [10:41:30] WARNING: housesystem\server.lua:535: dbPoll failed; no such table: houses [10:41:30] ERROR: housesystem\server.lua:556: Houses Table not Found\empty! start: Resource 'housesystem' started مود أشتغل بس يطلع مشاكل + عندا مروح أسوي بيت يطلعلي مشكله جديد [10:42:10] WARNING: housesystem\server.lua:678: dbPoll failed; no such table: houses [10:42:10] ERROR: housesystem\server.lua:689: House 1 could not create! An Error occurred while creating the house! Link to comment
3NAD Posted March 28, 2015 Share Posted March 28, 2015 -- MySQL Housesystem created & released by Noneatme(MuLTi), Do not remove credits! -- -- All Rights go to Noneatme -- --[[ Total time token: - 3 hour - 1.5 hour ________ 4.5 hours ]] ------------------------ -- CONNECTION HANDLER -- ------------------------ -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" local dbpTime = 500 -- How many Miliseconds will use the dbPoll function for waiting for a result local max_player_houses = 2 -- Define the buyable houses per player local sellhouse_value = 80 -- The ammount in percent that you get back if you sell a house local open_key = "F5" -- Define the key for the infomenue and the housepanel -- I don't know whats the right time for that -- ----------------------------------------------------------------- -- IF YOU CAN'T WRITE IN LUA, DO NOT EDIT ANYTHING ABOVE HERE! -- ----------------------------------------------------------------- -- EVENTS -- addEvent("onHouseSystemHouseCreate", true) addEvent("onHouseSystemHouseLock", true) addEvent("onHouseSystemHouseDeposit", true) addEvent("onHouseSystemHouseWithdraw", true) addEvent("onHouseSystemWeaponDeposit", true) addEvent("onHouseSystemWeaponWithdraw", true) addEvent("onHouseSystemRentableSwitch", true) addEvent("onHouseSystemRentalprice", true) addEvent("onHouseSystemTenandRemove", true) addEvent("onHouseSystemInfoBuy", true) addEvent("onHouseSystemInfoRent", true) addEvent("onHouseSystemInfoEnter", true) local handler -- local only, we don't need a global handler local saveableValues = { ["MONEY"] = "MONEY", ["WEAP1"] = "WEAP1", ["WEAP2"] = "WEAP2", ["WEAP3"] = "WEAP3", ["LOCKED"] = "LOCKED", ["OWNER"] = "OWNER", ["RENTABLE"] = "RENTABLE", ["RENTALPRICE"] = "RENTALPRICE", ["RENT1"] = "RENT1", ["RENT2"] = "RENT2", ["RENT3"] = "RENT3", ["RENT4"] = "RENT4", ["RENT5"] = "RENT5", } local created = false -- DONT EDIT local houseid = 0 -- Define the Houseid, local house = {} -- The House array local houseData = {} -- The House Data arry local houseInt = {} -- The House Interior array local houseIntData = {} -- The House Interior Data Array local buildStartTick local buildEndTick local rentTimer -- STARTUP EVENT HANDLER -- addEventHandler("onResourceStart", getResourceRootElement(), function() handler = dbConnect("sqlite", ".sql files/FOR EXISTING DATABASES/execute_this.sql") -- If the Handler 1 dont work if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down...") cancelEvent() else dbExec ( handler, "CREATE TABLE IF NOT EXISTS `houses` (`X`, `Y`, `Z`, `INTERIOR`, `INTX`, `INTY`, `INTZ`, `PRICE`)") outputServerLog("[HOUSESYSTEM]MySQL handler 1 accepted!") housesys_startup() end end) -- SHUTDOWN EVENT HANDLER -- addEventHandler("onResourceStop", getResourceRootElement(), function() -- Free the arrays -- for index, houses in pairs(house) do houses = nil end for index, houseDatas in pairs(houseData) do houseDatas = nil end for index, houseInts in pairs(houseInt) do houseInts = nil end for index, houseIntDatas in pairs(houseIntData) do houseIntDatas = nil end houseid = 0 created = false end) -------------- -- COMMANDS -- -------------- -- /unrent -- addCommandHandler("unrent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(isPlayerRentedHouse(thePlayer, id) == false) then outputChatBox("You are not tenad of this house!", thePlayer, 255, 0, 0) return end local sucess = removeHouseTenand(id, thePlayer) if(sucess == true) then outputChatBox("You have sucessfull terminate the tenancy!", thePlayer, 0, 255, 0) else outputChatBox("An error occurred!", thePlayer, 255, 0, 0) end end end) -- /rent -- addCommandHandler("rent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) then outputChatBox("You can't rent here! It's your house!", thePlayer, 255, 0, 0) return end if(tonumber(houseData[id]["RENTABLE"]) ~= 1) then outputChatBox("This house is not rentable!", thePlayer, 255, 0, 0) return end if(getPlayerRentedHouse(thePlayer) ~= false) then outputChatBox("You are allready a tenand in a house! Use /unrent first.", thePlayer, 255, 0, 0) return end local sucess = addHouseTenand(thePlayer, id) if(sucess == true) then outputChatBox("You are now tenand this house!", thePlayer, 0, 255, 0) else outputChatBox("You can't rent this house!", thePlayer, 255, 0, 0) end end end) -- /createhouse -- addCommandHandler("createhouse", function(thePlayer) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then if(getElementInterior(thePlayer) ~= 0) then outputChatBox("You are not outside!", thePlayer, 255, 0, 0) return end if(isPedInVehicle(thePlayer) == true) then outputChatBox("Please exit your vehicle.", thePlayer, 255, 0, 0) return end -- INSERT SECURITY OPTIONS LIKE ADMINLEVEL HERE( if(adminlevel > :~) then ...) triggerClientEvent(thePlayer, "onClientHouseSystemGUIStart", thePlayer) else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /in -- addCommandHandler("in", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = tonumber(house) if(tonumber(houseData[id]["LOCKED"]) == 0) or (houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then local int, intx, inty, intz, dim = houseIntData[id]["INT"], houseIntData[id]["X"], houseIntData[id]["Y"], houseIntData[id]["Z"], id setElementData(thePlayer, "house:in", true) setInPosition(thePlayer, intx, inty, intz, int, false, dim) unbindKey(thePlayer, open_key, "down", togglePlayerInfomenue, id) setElementData(thePlayer, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then bindKey(thePlayer, open_key, "down", togglePlayerHousemenue, id) end else outputChatBox("You don't have the housekey for this House!", thePlayer, 255, 0, 0) end end end end) -- /out -- addCommandHandler("out", function(thePlayer) if(getElementData(thePlayer, "house:lastvisitINT")) and (getElementData(thePlayer, "house:lastvisitINT") ~= false) then local house = getElementData(thePlayer, "house:lastvisitINT") if(house) then local id = tonumber(house) local x, y, z = houseData[id]["X"], houseData[id]["Y"], houseData[id]["Z"] setElementData(thePlayer, "house:in", false) setInPosition(thePlayer, x, y, z, 0, false, 0) end end end) -- /buyhouse -- addCommandHandler("buyhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= "no-one") then outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) else local houses = 0 for index, col in pairs(getElementsByType("colshape")) do if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then houses = houses+1 if(houses == max_player_houses) then outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) return end end end local money = getPlayerMoney(thePlayer) Link to comment
terreus Posted March 30, 2015 Author Share Posted March 30, 2015 3NAD said: -- MySQL Housesystem created & released by Noneatme(MuLTi), Do not remove credits! -- -- All Rights go to Noneatme -- --[[ Total time token: - 3 hour - 1.5 hour ________ 4.5 hours ]] ------------------------ -- CONNECTION HANDLER -- ------------------------ -- Here you can change some settings -- -- FIRST CONNECTION -- local mysqlhost1 = "localhost" local mysqluser1 = "root" local mysqlpassword1 = "" local mysqldatabase1 = "dbs_housesystem2" -- SECOND CONNECTION, OPTIONAL IF CONNECTION 1 DON'T WORK local mysqlhost2 = "localhost" local mysqluser2 = "root" local mysqlpassword2 = "" local mysqldatabase2 = "dbs_housesystem" local dbpTime = 500 -- How many Miliseconds will use the dbPoll function for waiting for a result local max_player_houses = 2 -- Define the buyable houses per player local sellhouse_value = 80 -- The ammount in percent that you get back if you sell a house local open_key = "F5" -- Define the key for the infomenue and the housepanel -- I don't know whats the right time for that -- ----------------------------------------------------------------- -- IF YOU CAN'T WRITE IN LUA, DO NOT EDIT ANYTHING ABOVE HERE! -- ----------------------------------------------------------------- -- EVENTS -- addEvent("onHouseSystemHouseCreate", true) addEvent("onHouseSystemHouseLock", true) addEvent("onHouseSystemHouseDeposit", true) addEvent("onHouseSystemHouseWithdraw", true) addEvent("onHouseSystemWeaponDeposit", true) addEvent("onHouseSystemWeaponWithdraw", true) addEvent("onHouseSystemRentableSwitch", true) addEvent("onHouseSystemRentalprice", true) addEvent("onHouseSystemTenandRemove", true) addEvent("onHouseSystemInfoBuy", true) addEvent("onHouseSystemInfoRent", true) addEvent("onHouseSystemInfoEnter", true) local handler -- local only, we don't need a global handler local saveableValues = { ["MONEY"] = "MONEY", ["WEAP1"] = "WEAP1", ["WEAP2"] = "WEAP2", ["WEAP3"] = "WEAP3", ["LOCKED"] = "LOCKED", ["OWNER"] = "OWNER", ["RENTABLE"] = "RENTABLE", ["RENTALPRICE"] = "RENTALPRICE", ["RENT1"] = "RENT1", ["RENT2"] = "RENT2", ["RENT3"] = "RENT3", ["RENT4"] = "RENT4", ["RENT5"] = "RENT5", } local created = false -- DONT EDIT local houseid = 0 -- Define the Houseid, local house = {} -- The House array local houseData = {} -- The House Data arry local houseInt = {} -- The House Interior array local houseIntData = {} -- The House Interior Data Array local buildStartTick local buildEndTick local rentTimer -- STARTUP EVENT HANDLER -- addEventHandler("onResourceStart", getResourceRootElement(), function() handler = dbConnect("sqlite", ".sql files/FOR EXISTING DATABASES/execute_this.sql") -- If the Handler 1 dont work if not(handler) then outputServerLog("[HOUSESYSTEM]MySQL handler 2 not accepted! Shutting down...") cancelEvent() else dbExec ( handler, "CREATE TABLE IF NOT EXISTS `houses` (`X`, `Y`, `Z`, `INTERIOR`, `INTX`, `INTY`, `INTZ`, `PRICE`)") outputServerLog("[HOUSESYSTEM]MySQL handler 1 accepted!") housesys_startup() end end) -- SHUTDOWN EVENT HANDLER -- addEventHandler("onResourceStop", getResourceRootElement(), function() -- Free the arrays -- for index, houses in pairs(house) do houses = nil end for index, houseDatas in pairs(houseData) do houseDatas = nil end for index, houseInts in pairs(houseInt) do houseInts = nil end for index, houseIntDatas in pairs(houseIntData) do houseIntDatas = nil end houseid = 0 created = false end) -------------- -- COMMANDS -- -------------- -- /unrent -- addCommandHandler("unrent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(isPlayerRentedHouse(thePlayer, id) == false) then outputChatBox("You are not tenad of this house!", thePlayer, 255, 0, 0) return end local sucess = removeHouseTenand(id, thePlayer) if(sucess == true) then outputChatBox("You have sucessfull terminate the tenancy!", thePlayer, 0, 255, 0) else outputChatBox("An error occurred!", thePlayer, 255, 0, 0) end end end) -- /rent -- addCommandHandler("rent", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local id = tonumber(getElementData(thePlayer, "house:lastvisit")) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) then outputChatBox("You can't rent here! It's your house!", thePlayer, 255, 0, 0) return end if(tonumber(houseData[id]["RENTABLE"]) ~= 1) then outputChatBox("This house is not rentable!", thePlayer, 255, 0, 0) return end if(getPlayerRentedHouse(thePlayer) ~= false) then outputChatBox("You are allready a tenand in a house! Use /unrent first.", thePlayer, 255, 0, 0) return end local sucess = addHouseTenand(thePlayer, id) if(sucess == true) then outputChatBox("You are now tenand this house!", thePlayer, 0, 255, 0) else outputChatBox("You can't rent this house!", thePlayer, 255, 0, 0) end end end) -- /createhouse -- addCommandHandler("createhouse", function(thePlayer) if(hasObjectPermissionTo ( thePlayer, "function.kickPlayer", false ) ) then if(getElementInterior(thePlayer) ~= 0) then outputChatBox("You are not outside!", thePlayer, 255, 0, 0) return end if(isPedInVehicle(thePlayer) == true) then outputChatBox("Please exit your vehicle.", thePlayer, 255, 0, 0) return end -- INSERT SECURITY OPTIONS LIKE ADMINLEVEL HERE( if(adminlevel > :~) then ...) triggerClientEvent(thePlayer, "onClientHouseSystemGUIStart", thePlayer) else outputChatBox("You are not an admin!", thePlayer, 255, 0, 0) end end) -- /in -- addCommandHandler("in", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = tonumber(house) if(tonumber(houseData[id]["LOCKED"]) == 0) or (houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then local int, intx, inty, intz, dim = houseIntData[id]["INT"], houseIntData[id]["X"], houseIntData[id]["Y"], houseIntData[id]["Z"], id setElementData(thePlayer, "house:in", true) setInPosition(thePlayer, intx, inty, intz, int, false, dim) unbindKey(thePlayer, open_key, "down", togglePlayerInfomenue, id) setElementData(thePlayer, "house:lastvisitINT", id) if(houseData[id]["OWNER"] == getPlayerName(thePlayer)) or (isPlayerRentedHouse(thePlayer, id) == true) then bindKey(thePlayer, open_key, "down", togglePlayerHousemenue, id) end else outputChatBox("You don't have the housekey for this House!", thePlayer, 255, 0, 0) end end end end) -- /out -- addCommandHandler("out", function(thePlayer) if(getElementData(thePlayer, "house:lastvisitINT")) and (getElementData(thePlayer, "house:lastvisitINT") ~= false) then local house = getElementData(thePlayer, "house:lastvisitINT") if(house) then local id = tonumber(house) local x, y, z = houseData[id]["X"], houseData[id]["Y"], houseData[id]["Z"] setElementData(thePlayer, "house:in", false) setInPosition(thePlayer, x, y, z, 0, false, 0) end end end) -- /buyhouse -- addCommandHandler("buyhouse", function(thePlayer) if(getElementData(thePlayer, "house:lastvisit")) and (getElementData(thePlayer, "house:lastvisit") ~= false) then local house = getElementData(thePlayer, "house:lastvisit") if(house) then local id = house local owner = houseData[id]["OWNER"] if(owner ~= "no-one") then outputChatBox("You can't buy this house!", thePlayer, 255, 0, 0) else local houses = 0 for index, col in pairs(getElementsByType("colshape")) do if(getElementData(col, "house") == true) and (houseData[getElementData(col, "ID")]["OWNER"] == getPlayerName(thePlayer)) then houses = houses+1 if(houses == max_player_houses) then outputChatBox("You have allready "..max_player_houses.." houses! Sell a house to buy this one.", thePlayer, 255, 0, 0) return end end end 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