Jump to content

house system_mysql


MoeezKhan

Recommended Posts

Hi All this is house system why this script not start . when i press start nothing happen

----client side---

------------------------------------- 
-- HOUSE SYSTEM CREATED BY NONEATME --
-- -- - DO NOT REMOVE CREDITS - -- ---
--YOU ARE NOT ALLOWED TO COMPILE THIS-
--------------------------------------
 
-- EVENTS --
 
addEvent("onClientHouseSystemGUIStart", true)
addEvent("onClientHouseSystemMenueOpen", true)
addEvent("onClientHouseSystemMenueUpdate", true)
addEvent("onClientHouseSystemColshapeAdd", true)
addEvent("onClientHouseSystemInfoMenueOpen", true)
 
-- SOME SETTINGS --
 
local gMe = getLocalPlayer()
 
local houseInteriors = { -- I don't really use tables
    [1] = "223.0538482666, 1287.3552246094, 1082.140625, 1, Shitty house 1",
    [2] = "2233.6594238281, -1114.9837646484, 1050.8828125, 5, Hotel room 1",
    [3] = "2365.22265625, -1135.5612792969, 1050.8825683594, 8, Modern house 1",
    [4] = "2282.9401855469, -1140.1246337891, 1050.8984375, 11, Hotel room 2",
    [5] = "2196.7075195313, -1204.3569335938, 1049.0234375, 6, Modern house 2",
    [6] = "2270.0834960938, -1210.4854736328, 1047.5625, 10, Modern house 3",
    [7] = "2308.755859375, -1212.5498046875, 1049.0234375, 6, Shitty house 2",
    [8] = "2217.7729492188, -1076.2110595703, 1050.484375, 1, Hotel room 3",
    [9] = "2237.5009765625, -1080.9367675781, 1049.0234375, 2, Good house 1",
    [10] = "2317.7609863281, -1026.4268798828, 1050.2177734375, 9, Good Stair house 1",
    [11] = "261.05038452148, 1284.7646484375, 1080.2578125, 4, Goood house 2",
    [12] = "140.18000793457, 1366.7183837891, 1083.859375, 5, Modern house 4(Rich)",
    [13] = "83.037002563477, 1322.6156005859, 1083.8662109375, 9, Good Stair house 2",
    [14] = "-283.92623901367, 1471.0096435547, 1084.375, 15, Good Stair house 3",
    [15] = "-261.03778076172, 1456.6539306641, 1084.3671875, 4, Good Stair house 4",
    [16] = "-42.609268188477, 1405.8033447266, 1084.4296875, 8, Shitty house 3",
    [17] = "-68.839866638184, 1351.4775390625, 1080.2109375, 6, Shitty house 4",
    [18] = "2333.068359375, -1077.0648193359, 1049.0234375, 6, Shitty house 5",
    [19] = "1261.1168212891, -785.38037109375, 1091.90625, 5, Mad Doggs Mansion",
    [20] = "2215.1145019531, -1150.4993896484, 1025.796875, 15, Jefferson Motel",
    [21] = "2352.4575195313, -1180.9454345703, 1027.9765625, 5, Burning desire house(Buggy)",
    [22] = "421.94845581055, 2536.5021972656, 10, 10, Abandoned Tower",
    [23] = "2495.9753417969, -1692.4174804688, 1014.7421875, 3, Johnson house",
    [24] = "-2158.7209472656, 642.83074951172, 1052.375, 1, Bet Interior",
    [25] = "1701.1682128906, -1667.759765625, 20.21875, 18, Atrium lobby",
    [26] = "2324.499, -1147.071, 1050.71, 12, Modern House 5(Rich)",
    [27] = "244.411987,305.032989,999.148437, 1, 1 Room house",
    [28] = "271.884979,306.631988,999.148437, 2, 1 Room house",
    [29] = "302.180999,300.722991,999.148437, 4, 1 Room house",
}
 
local Guivar = 0 -- createhouse Menue
local Guivar2 = 0 -- MENUE
local Guivar3 = 0
 
local Fenster = {}
local Knopf = {}
local Label = {}
local Edit = {}
local Grid = {}
local Bild = {}
 
local Fenster2 = {}
local Knopf2 = {}
local Label2 = {}
local Edit2 = {}
local Radio2 = {}
local Checkbox2 = {}
local Grid2 = {}
 
local Fenster3 = {}
local Knopf3 = {}
local Label3 = {}
--------------------
-- EVENT HANDLERS --
--------------------
 
 
 
-- MENUE UPDATE --
 
addEventHandler("onClientHouseSystemMenueUpdate", getRootElement(), function(string, value, int)
    if(Guivar2 == 0) then return end
    if(string == "LOCKED") then
        if(value == 0) then
            guiSetText(Knopf2[6], "Lock house")
        else
            guiSetText(Knopf2[6], "Unlock house")
        end
    elseif(string == "MONEY") then
        guiSetText(Label2[3], "Current Money:\n"..value.."$")
    elseif(string == "WEAPON") then
        if(value == 1) then
            if(type(int) == "string") then
                guiSetText(Label2[6], "Slot 1: "..getWeaponNameFromID(gettok(int, 1, ",")).."\nAmmo: "..gettok(int, 2, ","))
            else
                guiSetText(Label2[6], "Slot 1: -\nAmmo: -")
            end
        elseif(value == 2) then
            if(type(int) == "string") then
                guiSetText(Label2[7], "Slot 2: "..getWeaponNameFromID(gettok(int, 1, ",")).."\nAmmo: "..gettok(int, 2, ","))
            else
                guiSetText(Label2[7], "Slot 2: -\nAmmo: -")
            end
        elseif(value == 3) then
            if(type(int) == "string") then
                guiSetText(Label2[9], "Slot 3: "..getWeaponNameFromID(gettok(int, 1, ",")).."\nAmmo: "..gettok(int, 2, ","))
            else
                guiSetText(Label2[9], "Slot 3: -\nAmmo: -")
            end
        end
    elseif(string == "RENTABLE") then
        if(value == true) then
            guiSetText(Knopf2[9], "Set unrentable")
        else
            guiSetText(Knopf2[9], "Set rentable")
        end
    elseif(string == "RENTALPRICE") then
        guiSetText(Label2[15], "Rentalprice: $"..value)
    elseif(string == "TENANDS") then
        guiGridListClear(Grid2[1])
        for index, player in pairs(value) do
            if(player ~= "no-one") then
                local row = guiGridListAddRow(Grid2[1])
                guiGridListSetItemText(Grid2[1], row, 1, player, false, false)
            end
        end
    end
end)
 
-- INFO MENUE --
 
 
addEventHandler("onClientHouseSystemInfoMenueOpen", gMe, function(owner, x, y, z, price, locked, rentable, rentalprice, id, doingrent, isrentedin, canadd)
    if(Guivar3 == 1) then
        destroyElement(Fenster3[1])
        showCursor(false)
        Guivar3 = 0
        return
    end
    Guivar3 = 1
    showCursor(true)
    guiSetInputMode("no_binds_when_editing")
 
    -- Make the variables --
   
    local lockedstate = "no"
    if(tonumber(locked) == 1) then lockedstate = "yes" end
    local rentstate = "no"
    if(tonumber(rentable) == 1) then rentstate = "yes" end
   
    local X, Y, Width, Height = getMiddleGuiPosition(270,251)
    Fenster3[1] = guiCreateWindow(X, Y, Width, Height,"Houseinformation",false)
    Label3[1] = guiCreateLabel(12,43,253,15,"House ID: "..id,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[1],"center",false)
    guiSetFont(Label3[1],"default-bold-small")
    Label3[2] = guiCreateLabel(10,22,257,15,"House Informations:",false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[2],"center",false)
    guiSetFont(Label3[2],"default-bold-small")
    Label3[3] = guiCreateLabel(10,25,259,15,"_______________________",false,Fenster3[1])
    guiLabelSetColor(Label3[3],0, 255, 0)
    guiLabelSetHorizontalAlign(Label3[3],"center",false)
    Label3[4] = guiCreateLabel(12,61,251,18,"Location: "..getZoneName(x, y, z, false),false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[4],"center",false)
    guiSetFont(Label3[4],"default-bold-small")
    Label3[5] = guiCreateLabel(12,81,250,14,"Owner: "..owner,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[5],"center",false)
    guiSetFont(Label3[5],"default-bold-small")
    Label3[6] = guiCreateLabel(12,100,252,15,"Price: $"..price,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[6],"center",false)
    guiSetFont(Label3[6],"default-bold-small")
    Label3[7] = guiCreateLabel(12,118,250,14,"Rentable: "..rentstate,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[7],"center",false)
    guiSetFont(Label3[7],"default-bold-small")
    Label3[8] = guiCreateLabel(12,137,247,14,"Rentalprice: $"..rentalprice,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[8],"center",false)
    guiSetFont(Label3[8],"default-bold-small")
    Label3[9] = guiCreateLabel(12,155,247,12,"Locked: "..lockedstate,false,Fenster3[1])
    guiLabelSetHorizontalAlign(Label3[9],"center",false)
    guiSetFont(Label3[9],"default-bold-small")
    Knopf3[1] = guiCreateButton(9,175,124,32,"Buy house",false,Fenster3[1])
    Knopf3[2] = guiCreateButton(137,175,124,32,"Rent house",false,Fenster3[1])
    Knopf3[3] = guiCreateButton(9,210,124,32,"Close",false,Fenster3[1])
    Knopf3[4] = guiCreateButton(137,209,124,32,"Enter",false,Fenster3[1])
   
    --------------
    -- SETTINGS --
    --------------
   
    -- ENTER BUTTON --
    if(getPlayerName(gMe) ~= owner) then
        if(isrentedin == true) then
       
        else
            if(tonumber(locked) == 1) then
                guiSetEnabled(Knopf3[4], false)
            end
        end
    end
   
    -- RENT HOUSE BUTTON --
    if(getPlayerName(gMe) == owner) then
        guiSetEnabled(Knopf3[2], false)
    else
        if(doingrent == true) or(owner == "no-one") or (tonumber(rentable) == 0) or (canadd == false) then
            guiSetEnabled(Knopf3[2], false)
        end
        if(isrentedin == true) then
            guiSetEnabled(Knopf3[2], true)
            guiSetText(Knopf3[2], "Unrent house")
        end
    end
   
    -- BUYHOUSE BUTTON --
    if(owner ~= "no-one") then
        guiSetEnabled(Knopf3[1], false)
        if(owner == getPlayerName(gMe)) then
            guiSetEnabled(Knopf3[1], true)
            guiSetText(Knopf3[1], "Sell house")
        end
    end
    -- EVENT HANDLERS --
   
    -- RENT --
   
    addEventHandler("onClientGUIClick", Knopf3[2], function()
        local text = guiGetText(Knopf3[2])
        Guivar3 = 0
        showCursor(false)
        destroyElement(Fenster3[1])
        if(text == "Rent house") then
            triggerServerEvent("onHouseSystemInfoRent", gMe, id, true)
        else
            triggerServerEvent("onHouseSystemInfoRent", gMe, id, false)
        end
    end, false)
   
    -- BUY HOUSE --
    addEventHandler("onClientGUIClick", Knopf3[1], function()
        local text = guiGetText(Knopf3[1])
        Guivar3 = 0
        showCursor(false)
        destroyElement(Fenster3[1])
        if (text == "Buy house") then
            triggerServerEvent("onHouseSystemInfoBuy", gMe, id, true)
        else
            triggerServerEvent("onHouseSystemInfoBuy", gMe, id, false)
        end
    end, false)
   
    -- ENTER --
   
Link to comment
You need to get a MySQL database by purchasing web space or simply just a MySQL server.

If you're running the server locally, you can install MAMP, XAMPP or a SQL server. You can find information with Google, simply.

I suggest installing either MAMP or XAMPP so you can run phpMyAdmin, which allows you to edit MySQL databases on localhost.

Or one of the 1 billion free website hosting sites (e.g: http://www.000webhost.com)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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