Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-01-17, 19:53


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
Brama sie nie otwiera,
server:
function CDomki()
    local object = {}
    
    -- domki do kupna
        removeWorldModel(138171000,     1353.23, -625.68109.13) --lod
    local garazeDayZ = {
        jakis createObject(30951353.66, -626.34109.13, -0.00.0193.3)
    }
    object.domki = 
    {    -- [id] = {xyzpreset interiorucenawlasciciel(nie zmieniamy z nil), garazIDczas(nie zmieniamy z 0) }
        
        [1] = {2495.23, -1690.4213.514000nil90}, -- dom johnsonagrove
        [2] = {2523.38, -165814.422350nilfalse0}, -- dom po lewej od koszykowki grove
        [3] = {2486.5, -1645.81333100nilfalse0}, -- dom 2-pietrowy grove 
        [4] = {315.17, -17713.633250nil130}, -- dom na plazy 2-pietrowy garaz
        [5] = {1298.69, -800.4683410000nilfalse0}, -- willa madd doga
        [6] = {2468.79, -1295.5328.922200nilfalse0}, -- dom jednorodzinny kolo strip clubu
        [7] = {2068.12, -1731.6312.862000nilfalse0}, -- kolo pizzerii
        [8] = {2069, -171712.562000nilfalse0}, -- kolo domku wyzej
        [9] = {1981.72, -1682.741633300nilfalse0}, -- domek 2 pi?trowy ko?o domk?w wy?ej
        [10] = {1981.47, -1718.941633250nilfalse0}, -- domek 2 pi?trowy kolejny obok tego wy?ej
        [11] = {1331.41, -631.56108.1354000nilgarazeDayZ.jakis0}, -- domek mulholland
        [12] = {1686, -210012.873000nil50}, -- domek el corona
        [13] = {2382.98, -1366.2923.462100nilfalse0}, -- syfiaste domki kolo grove start
        [14] = {2389.5, -1346.112462100nilfalse0},
        [15] = {2387.48, -1328.3224.1262100nilfalse0},
        [16] = {2387.93, -1279.7224.1262100nilfalse0},
        [17] = {2126.72, -1320.1225.633050nilfalse0},
        [18] = {168.53, -1769.813.4553500nilfalse0},
        [19] = {656.5, -1652.6914.472500nilfalse0},
        [20] = {652.19, -1619.8441453200nilfalse0},
        [21] = {692.981, -1602.3161472500nilfalse0},
        [22] = {1182.56, -1074.8430.653890nilfalse0},
        [23] = {1142.86, -1069.2230.723250nilfalse0},
    };
    
    -- presety interior?w
    object.interiors = 
    {
        -- [id] = {interiorIDxyz wyjscia}
        -- grove street
        [1] = {32496.05, -1692.721014}, -- dom johnsona
        [2] = {42611284.71080}, -- wielopokojowy dom jednorodzinny
        [3] = {92317.8, -1026.291050}, -- dom 2 pi?trowy, ?adny
        [4] = {51298.99, -794.471084}, -- willa
        [5] = {102269.66, -1210.351047.56}, -- dom jednorodzinnydu?o pokoi, ?adnie wystrojony
        [6] = {12231287.741082}, -- syfklasa za 2000$
        [7] = {6, -691351.941080}, -- klasa za 2500$-2750max
        [8] = {5140.136137.4491083}, -- willa 6000minimum
    };
    
    object.dimension 5;
    


    function object:refresh()
        for k,v in ipairs(getAccounts()) do
        local domki getAccountData(v"domki") or false
        local domki_t getAccountData(v"domki_timestamp") or false
        if domki and domki_t then
            -- wczytanie domk?w gracza
            -- konwersja z JSON tablicy bo system kont nie obsluguje tablic
            domki fromJSON(domki)
            domki_t fromJSON(domki_t)
            local t 0
            if type(domki) == "table" then
                for idomek in pairs(domki) do
                    -- aktualizacja czasu najmu
                        t domki_t[i]
                        local now getRealTime().timestamp
                        if now then
                            outputDebugString("Domek id "..tostring(domek).." - usuni?cie po terminie"3)
                            object.domki[domek][8] = 0
                            object.domki[domek][6] = false
                        
                            table.remove(domkii)
                            table.remove(domki_ti)
                        
                            if #domki_t == 0 then
                                domki false
                                domki_t false
                            end
                        
                            setAccountData(v"domki"toJSON(domki))
                            setAccountData(v"domki_timestamp"toJSON(domki_t))
                        else
                            object.domki[domek][8] = t
                            object.domki[domek][6] = getAccountName(v)
                        end    
                    end
                end
            end
        end
    end
    object:refresh()
    
    -- aktualizacja w?a?ciciel?w domk?w
    setTimer(
    function()
        restartResource(getThisResource())
    end,60000*300)
    
    -- stworzenie marker?w w domkach
    for kv in ipairs(object.domki) do
        local id v[4]
        local x,y,object.interiors[id][2], object.interiors[id][3], object.interiors[id][4]
        local marker createMarker(xyz-0.7"cylinder"2.00255050root)
        setElementInterior(markerobject.interiors[id][1])
        setElementDimension(markerk)
        setElementData(marker"dom:exit"true)
    end
    
    -- stworzenie marker?w
    for k,v in ipairs(object.domki) do
        local x,y,v[1], v[2], v[3]
        local interior v[4]
        local cena v[5]
        local wlasciciel v[6]
        local garaz v[7]
        local timestamp v[8]
        local markerpickupblip;
        if type(wlasciciel) == "string" then
            marker createMarker(xyz"cylinder"2.002550100root)
            pickup createPickup(xyz+1312730)
            blip createBlipAttachedTo(marker322255002550300)
        else
            marker createMarker(xyz"cylinder"2.00150255100root)
            pickup createPickup(xyz+1312720) 
            blip createBlipAttachedTo(marker312255002550300)
        end
        
        addEventHandler("onMarkerHit"marker, function(hitElement) if getElementType(hitElement) == "player" and not getPedOccupiedVehicle(hitElementthen object:onDomEnter(hitElement); end end);
        
        -- zapisanie danych do markeru
        setElementData(marker"dom:id"k)
        setElementData(marker"dom:interior"object.interiors[interior][1])
        setElementData(marker"dom:enterPosX"object.interiors[interior][2])
        setElementData(marker"dom:enterPosY"object.interiors[interior][3])
        setElementData(marker"dom:enterPosZ"object.interiors[interior][4])
        setElementData(marker"dom:cena"cena)
        setElementData(marker"dom:wlasciciel"wlasciciel)
        setElementData(marker"dom:garaz"garaz)
        setElementData(marker"dom:pickup"pickup)
        setElementData(marker"dom:open"true)
        setElementData(marker"dom:timestamp"timestamp)
        setElementData(marker"dom:blip"blip)
        
        -- i pickupu by przyspieszyc renderowanie tekstow(po co robip?tle na wszystkie markery)
        setElementData(pickup"dom"true)
        setElementData(pickup"dom:interior"interior)
        setElementData(pickup"dom:cena"cena)
        setElementData(pickup"dom:wlasciciel"wlasciciel)
        setElementData(pickup"dom:garaz"garaz)
        setElementData(pickup"dom:pickup"pickup)
        setElementData(pickup"dom:timestamp"timestamp)
    end
    
    function object:onDomEnter(hitElement)
        if getElementType(hitElement) == "player" and not getElementData(hitElement"dom:exit"then
            triggerClientEvent(hitElement"domki:showWindow"source)
        end
    end
    
    
-- sprawdzanie markerow w interiorze
    addEventHandler("onMarkerHit"root,
        function(hitElementdimension)
            if dimension then
                if getElementData(source"dom:exit") ~= true then return end
                if getElementData(hitElement"dom:entered"then return end
                local pos getElementData(hitElement"dom:exit")
                local x,y,pos[1], pos[2], pos[3]
                fadeCamera(hitElementfalse2.0)
                setTimer(
                    function()
                        setElementPosition(hitElementxyz+0.6)
                        setElementInterior(hitElement0)
                        setElementDimension(hitElement0)
                        fadeCamera(hitElementtrue2.0)
                        setTimer(setElementData20001hitElement"dom:exit"false)
                    end20001)
            end
        end
    )
    function object:enterInterior(marker)
        local interior getElementData(marker"dom:interior")
        local xygetElementData(marker"dom:enterPosX"), getElementData(marker"dom:enterPosY"), getElementData(marker"dom:enterPosZ")
        local dimension getElementData(marker"dom:id"); -- na stale zapisana!
                    
        local eXeYeZ getElementPosition(marker); -- pozycja do powrotu
        setElementData(client"dom:exit", {eXeYeZ})
                    
        setElementData(client"dom:entered"true) -- aby nie wyjsc od razu po wejsciu
        setTimer(setElementData50001client"dom:entered"false)
                    
        setElementInterior(clientinterior)
        setElementDimension(clientdimension)
        setElementPosition(clientxyz)
        fadeCamera(clienttrue2.0)
    end
    addEvent("domki:enterInterior"true)
    addEventHandler("domki:enterInterior"root, function(aobject:enterInterior(aend)
    
    function object:buyHouse(moneymarkertime)
        local playerAcc getPlayerAccount(client)
        local domki getAccountData(playerAcc"domki") or false
        if domki ~= false and fromJSON(domki) ~= false then
            if #fromJSON(domki) >= 3 then
                outputChatBox("Przekroczy?e? limit kupionych domk?w."client25500)
                return
            end
        end
        
        setElementData(client"GP"getElementData(client"GP") - money)
        local id getElementData(marker"dom:id")
        
        local timestamp getRealTime().timestamp
        time 86400*time
        timestamp timestamp time
        
        if domki and type(fromJSON(domki)) == "table" then
            -- zapisanie domku do konta gracza
            domki fromJSON(domki)
            table.insert(domkiid)
            setAccountData(playerAcc"domki"toJSON(domki))
            
            -- jakis bug i nie moge zapisac w jednej dacie timestampu i id
            domki_timestamp getAccountData(playerAcc"domki_timestamp")
            domki_timestamp fromJSON(domki_timestamp)
            table.insert(domki_timestamptimestamp)
            setAccountData(playerAcc"domki_timestamp"toJSON(domki_timestamp))
        else
            -- pierwszy domek do zapisania
            setAccountData(playerAcc"domki"toJSON({id}))
            setAccountData(playerAcc"domki_timestamp"toJSON({timestamp}))
        end
        
        -- aktualizacja stanu domku
        local blip getElementData(marker"dom:blip")
        setBlipIcon(blip32)
        
        local pickup getElementData(marker"dom:pickup")
        setElementData(marker"dom:wlasciciel"getAccountName(playerAcc))
        setElementData(pickup"dom:wlasciciel"getAccountName(playerAcc))
        
        setElementData(marker"dom:timestamp"timestamp)
        setElementData(pickup"dom:timestamp"timestamp)
        
        setPickupType(pickup31273)
        setMarkerColor(marker02550100)
        
        outputChatBox("Zakupi?e? dom!"client02550)
    end
    addEvent("domki:buyHouse"true)
    addEventHandler("domki:buyHouse"root, function(abcobject:buyHouse(abcend)
    
    function object:sellHouse(pricemarker)
        if price and marker then
        --    givePlayerMoney(clientprice)
        setElementData(client"GP"getElementData(client"GP") + price)
            local id getElementData(marker"dom:id")
            local pickup getElementData(marker"dom:pickup")
            local blip getElementData(marker"dom:blip")
            setPickupType(pickup31272)
            setMarkerColor(marker0150255100)
            setBlipIcon(blip31)
            setElementData(marker"dom:wlasciciel"false)
            setElementData(marker"dom:timestamp"false)
            setElementData(marker"dom:open"true)
            
            setElementData(pickup"dom:wlasciciel"false)
            setElementData(pickup"dom:timestamp"false)
            
            local acc getPlayerAccount(client)
            local domki getAccountData(acc"domki")
            local domki_t getAccountData(acc"domki_timestamp")
            
            domki fromJSON(domki)
            domki_t fromJSON(domki_t)
            
            for idomek in ipairs(domki) do
                if id == domek then
                    outputDebugString("Domek id "..tostring(domek).." - sprzedanie"3)
                    object.domki[domek][8] = 0
                    object.domki[domek][6] = false
                        
                    table.remove(domkii)
                    table.remove(domki_ti)
                        
                    if #domki_t == 0 then
                        domki false
                        domki_t false
                    end
                        
                    setAccountData(acc"domki"toJSON(domki))
                    setAccountData(acc"domki_timestamp"toJSON(domki_t))
                end
            end
            
            outputChatBox("Sprzeda?e? sw?j domek!"client02550)
        end
    end
    addEvent("domki:sellHouse"true)
    addEventHandler("domki:sellHouse"root, function(abobject:sellHouse(abend)
    
    function object:przedluz(moneymarkertime)
        --takePlayerMoney(clientmoney)    
        setElementData(client"GP"getElementData(client"GP") - money)
        local id getElementData(marker"dom:id")
        
        local playerAcc getPlayerAccount(client)
        local domki getAccountData(playerAcc"domki") or false
        local timestamp 86400*time
        
        domki_timestamp fromJSON(getAccountData(playerAcc"domki_timestamp"))
        for k,v in ipairs(fromJSON(getAccountData(playerAcc"domki"))) do
            if == id then
                domki_timestamp domki_timestamp[k]
                timestamp timestamp domki_timestamp
                
                local table fromJSON(getAccountData(playerAcc"domki_timestamp"))
                table[k] = timestamp
        
                setAccountData(playerAcc"domki_timestamp"toJSON(table))
                break
            end
        end
        
        local pickup getElementData(marker"dom:pickup")
        setElementData(marker"dom:timestamp"timestamp)
        setElementData(pickup"dom:timestamp"timestamp)
        outputChatBox("Przed?u?ono domek!"client02550)
    end
    addEvent("domki:przedluz"true)
    addEventHandler("domki:przedluz"root, function(moneymarkertimeobject:przedluz(moneymarkertimeend)
    
function object:openGarage(garaz)
    local garazyk getElementData(garaz"dom:garaz")
   local id getElementData(garaz"domek:id")
   if garazyk then 
   if id == 11 then 
    moveObject(garazeDayZ.jakis10001353.66, -626.34109.13-10)
end 
    end
end
    addEvent("domki:openGarage"true)
    addEventHandler("domki:openGarage"root, function(aobject:openGarage(aend)
    
    return object;
end

CDomki()


client
function CDomki()
    local object = {};
    
    object.dom_wnd guiCreateWindow(0.550.640.440.34"Dom na sprzeda?"true)
    guiWindowSetSizable(object.dom_wndfalse)
    guiSetVisible(object.dom_wndfalse)
    
    object.dom_kup_btn guiCreateButton(0.030.540.260.19"Kup"trueobject.dom_wnd)
    object.dom_sprzedaj_btn guiCreateButton(0.380.540.260.19"Sprzedaj"trueobject.dom_wnd)
    guiSetProperty(object.dom_sprzedaj_btn"Disabled""True")
    object.dom_wejdz_btn guiCreateButton(0.720.540.260.19"Wejd?"trueobject.dom_wnd)
    object.dom_otworz_btn guiCreateButton(0.030.760.260.19"Otw?rz/Zamknij dom"trueobject.dom_wnd)
    object.dom_lbl_info guiCreateLabel(0.030.130.980.36"W?a?ciciel: brak\nCena: 3000$ za dzie?\nGara?: nie\n\nAby zamkn?? GUI, kliknij poza okno."trueobject.dom_wnd)
    object.dom_otworzg_btn guiCreateButton(0.380.760.260.19"Otw?rz/Zamknij gara?"trueobject.dom_wnd)
    object.dom_przedluz_btn guiCreateButton(0.720.760.260.19"Przed?u?"trueobject.dom_wnd) 
    
    -- buy window
    object.dom_buy_wnd guiCreateWindow(0.310.350.390.24"Na ile chcesz kupi? dom?"true)
    guiWindowSetSizable(object.dom_buy_wndfalse)
    guiSetVisible(object.dom_buy_wndfalse)
    
    object.dom_day_lbl guiCreateLabel(0.030.170.150.11"Ilo?? dni"trueobject.dom_buy_wnd)
    object.dom_dni_edit guiCreateEdit(0.230.170.150.14""trueobject.dom_buy_wnd)
    object.dom_kwota guiCreateLabel(0.030.350.910.17"Kwota ko?cowa: 0 * $2000 = $0"trueobject.dom_buy_wnd)
    object.dom_finalkup_wnd guiCreateButton(0.040.610.420.26"Kup"trueobject.dom_buy_wnd)
    object.dom_buy_anuluj guiCreateButton(0.540.610.420.26"Anuluj"trueobject.dom_buy_wnd)   
    
    -- okno do przed?u?enia
    object.dom_przedluz_wnd guiCreateWindow(0.310.350.390.24"Na ile chcesz przed?u?y? dom?"true)
    guiWindowSetSizable(object.dom_przedluz_wndfalse)
    guiSetVisible(object.dom_przedluz_wndfalse)
    
    object.dom_dayprzedluz_lbl guiCreateLabel(0.030.170.150.11"Ilo?? dni"trueobject.dom_przedluz_wnd)
    object.dom_dniprzedluz_edit guiCreateEdit(0.230.170.150.14""trueobject.dom_przedluz_wnd)
    object.dom_kwotaprzedluz guiCreateLabel(0.030.350.910.17"Kwota ko?cowa: 0 * $2000 = $0"trueobject.dom_przedluz_wnd)
    object.dom_finalprzedluz_btn guiCreateButton(0.040.610.420.26"Przed?u?"trueobject.dom_przedluz_wnd)
    object.dom_przedluz_anuluj guiCreateButton(0.540.610.420.26"Anuluj"trueobject.dom_przedluz_wnd)   
    
    -- okno do sprzeda?y
    object.dom_sprzedaj_wnd guiCreateWindow(0.300.280.390.21"Czy na pewno chcesz sprzeda? ten domek?"true)
    guiWindowSetSizable(object.dom_sprzedaj_wndfalse)
    guiSetVisible(object.dom_sprzedaj_wndfalse)
    
    object.dom_sprzedaj_tak guiCreateButton(0.060.390.360.48"Tak"trueobject.dom_sprzedaj_wnd)
    object.dom_sprzedaj_nie guiCreateButton(0.580.390.360.48"Nie"trueobject.dom_sprzedaj_wnd)
    addEventHandler("onClientGUIClick"object.dom_sprzedaj_nie, function() guiSetVisible(object.dom_sprzedaj_wndfalseend)
    
    object.dom_sprzedaj_info guiCreateLabel(0.040.150.890.17"Mo?esz sprzeda? ten dom za 0$."trueobject.dom_sprzedaj_wnd)  
    
    -- zmienne do zapami?tania przez gracza
    object.currentMarker nil
    object.currentPrice nil
    object.finalPrice nil
    object.garazID nil
    object.finalTime nil
    
    function object:show()
        local state guiGetVisible(self.dom_wnd)
        guiSetVisible(self.dom_wndnot state)
        showCursor(not state)
        
        if state then return end
        -- update informacji
        self.currentMarker source
        local wlasciciel getElementData(source"dom:wlasciciel") or "Brak"
        local cena getElementData(source"dom:cena") or "0"
        self.currentPrice cena
        local garaz getElementData(source"dom:garaz")
        if garaz then
            if not getElementData(localPlayer"vip"then
                if wlasciciel == getAccountName(localPlayerthen
                    outputChatBox("Musisz posiada? konto VIP aby przed?u?y? ten domek."0255255)
                end
            end
        end
        
        if garaz then 
            garaz "Tak"
            guiSetProperty(self.dom_otworzg_btn"Disabled""False")
        else
            garaz "Nie" 
            guiSetProperty(self.dom_otworzg_btn"Disabled""True")
        end
        
        self.garazID getElementData(source"dom:garaz")
        
        local open getElementData(source"dom:open")
        if open then
            guiSetProperty(self.dom_wejdz_btn"Disabled""False")
        else
            if wlasciciel == getAccountName(localPlayerthen
                guiSetProperty(self.dom_wejdz_btn"Disabled""False")
            else
                guiSetProperty(self.dom_wejdz_btn"Disabled""True")
            end
        end
        
        if wlasciciel ~= "Brak" then
            guiSetText(self.dom_wnd"Dom "..wlasciciel)
            if getAccountName(localPlayer) == wlasciciel then
                guiSetProperty(self.dom_sprzedaj_btn"Disabled""False")
                guiSetProperty(self.dom_otworz_btn"Disabled""False")
                guiSetProperty(self.dom_otworzg_btn"Disabled""False")
                guiSetProperty(self.dom_przedluz_btn"Disabled""False")
                guiSetProperty(self.dom_kup_btn"Disabled""True")
            else
                guiSetProperty(self.dom_sprzedaj_btn"Disabled""True")
                guiSetProperty(self.dom_otworz_btn"Disabled""True")
                guiSetProperty(self.dom_otworzg_btn"Disabled""True")
                guiSetProperty(self.dom_przedluz_btn"Disabled""True")
                guiSetProperty(self.dom_kup_btn"Disabled""True")
            end
        else
            guiSetText(self.dom_wnd"Dom do wynaj?cia")
            guiSetProperty(self.dom_sprzedaj_btn"Disabled""True")
            guiSetProperty(self.dom_otworz_btn"Disabled""True")
            guiSetProperty(self.dom_otworzg_btn"Disabled""True")
            guiSetProperty(self.dom_przedluz_btn"Disabled""True")
            guiSetProperty(self.dom_kup_btn"Disabled""False")
        end

        guiSetText(self.dom_lbl_info"W?a?ciciel: "..tostring(wlasciciel).."\nCena: $"..tostring(cena).." dziennie\nGara?: "..garaz.."\n\nAby zamkn?? kliknij poza okno.")
    end
    addEvent("domki:showWindow"true)
    addEventHandler("domki:showWindow"root, function() object:show() end)

    function object:isCursorInAreacursorXcursorYminXminYmaxXmaxY )
        if cursorX minX or cursorX maxX or
           cursorY minY or cursorY maxY
        then
            return false
        end
        return true
    end
    
    function object:checkClicks(_statecursorXcursorY)
        local wxwy guiGetPosition(self.dom_wndfalse)
        local wwwh guiGetSize(self.dom_wndfalse)
        local isOutsideWindow self:isCursorInArea(cursorXcursorYwxwywx+wwwy+wh)
        if guiGetVisible(self.dom_buy_wndthen return end
        if guiGetVisible(self.dom_przedluz_wndthen return end
        if guiGetVisible(self.dom_sprzedaj_wndthen return end
        if not isOutsideWindow and guiGetVisible(self.dom_wndthen
            self:show()
        end
    end
    addEventHandler("onClientClick"root, function(abcdobject:checkClicks(abcdend)
    
    function object:checkGUIClicks()
        if source == self.dom_wejdz_btn then
            self:show()
            fadeCamera(false2.0)
            setTimer(
                function()
                    triggerServerEvent("domki:enterInterior"resourceRootself.currentMarker)
                end20001);
        elseif source == self.dom_kup_btn then
            if getElementData(self.currentMarker"dom:garaz") and not getElementData(localPlayer"vip"then outputChatBox("Musisz mie? konto VIP") return end
            guiSetVisible(self.dom_buy_wndtrue);
        elseif source == self.dom_buy_anuluj then
            guiSetVisible(self.dom_buy_wndfalse);
        elseif source == self.dom_finalkup_wnd then
            local money getElementData(localPlayer"GP");
            if not self.finalPrice then return end
            if money self.finalPrice then
                outputChatBox("Masz za ma?o pieni?dzy na kupno tego domu!"25500)
                return
            end
            
            triggerServerEvent("domki:buyHouse"resourceRootself.finalPriceself.currentMarkerself.finalTime)
            guiSetVisible(self.dom_buy_wndfalse);
            self:show()
        elseif source == self.dom_otworzg_btn then
            triggerServerEvent("domki:openGarage"resourceRootself.garazID)
        elseif source == self.dom_otworz_btn then
            local state getElementData(self.currentMarker"dom:open")
            if state == true then
                outputChatBox("Zamkn??e? dom. Inni nie mog? teraz do niego wchodzi?.")
                setElementData(self.currentMarker"dom:open"false)
            elseif state == false then
                outputChatBox("Otworzy?e? dom. Wszyscy mog? teraz do niego wchodzi?.")
                setElementData(self.currentMarker"dom:open"true)
            end
        elseif source == self.dom_przedluz_btn then
            if getElementData(self.currentMarker"dom:garaz") and not getElementData(localPlayer"vip"then outputChatBox("Musisz mie? konto VIP") return end
            guiSetVisible(self.dom_przedluz_wndtrue)
        elseif source == self.dom_przedluz_anuluj then
            guiSetVisible(self.dom_przedluz_wndfalse)
        elseif source == self.dom_finalprzedluz_btn then
            local money getElementData(localPlayer"GP");
            if not self.finalPrice then return end
            if money self.finalPrice then
                outputChatBox("Masz za ma?o pieni?dzy na przed?u?enie tego domu!"25500)
                return
            end
            
            triggerServerEvent("domki:przedluz"resourceRootself.finalPriceself.currentMarkerself.finalTime)
            guiSetVisible(self.dom_przedluz_wndfalse)
            self:show()
        elseif source == self.dom_sprzedaj_btn then
            local time getElementData(self.currentMarker"dom:timestamp")
            local realTimestamp getRealTime().timestamp
            time getRealTime(time).timestamp
            local days getRealTime(time realTimestamp).yearday
            if days 1 then days 1 end
            
            local price = (days*self.currentPrice)/2
            self.finalPrice price
            
            guiSetText(self.dom_sprzedaj_info"Mo?esz sprzeda? ten dom za "..tostring(price).."$.")
            guiSetVisible(self.dom_sprzedaj_wndtrue)
        elseif source == self.dom_sprzedaj_tak then
            triggerServerEvent("domki:sellHouse"resourceRootself.finalPriceself.currentMarker)
            guiSetVisible(self.dom_sprzedaj_wndfalse)
        end
    end
    addEventHandler("onClientGUIClick"root, function() object:checkGUIClicks() end)

    
    function object:render()
        -- update kupna
        if guiGetVisible(self.dom_buy_wndthen
            local str guiGetText(self.dom_dni_edit)
            local check tonumber(str)
            if check == nil then
                guiSetText(self.dom_dni_edit"")
                guiSetText(self.dom_kwota"Kwota ko?cowa: brak danych")
                self.finalPrice false;
            elseif type(check) == "number" then
                if check == 0 then
                    guiSetText(self.dom_dni_edit"")
                    guiSetText(self.dom_kwota"Kwota ko?cowa: brak danych")
                    self.finalPrice false
                end
                
                guiSetText(self.dom_kwota"Kwota ko?cowa: "..tostring(check).." * $"..tostring(self.currentPrice).." = $"..tostring(check self.currentPrice))
                self.finalPrice check self.currentPrice
                self.finalTime check
            end
            
            if string.len(str) > 3 then
                guiSetText(self.dom_dni_edit"")
                guiSetText(self.dom_kwota"Kwota ko?cowa: brak danych")
                self.finalPrice false
            end
            
        end
        
        if guiGetVisible(self.dom_przedluz_wndthen
            local str guiGetText(self.dom_dniprzedluz_edit)
            local check tonumber(str)
            if check == nil then
                guiSetText(self.dom_dniprzedluz_edit"")
                guiSetText(self.dom_kwotaprzedluz"Kwota ko?cowa: brak danych")
                self.finalPrice false;
            elseif type(check) == "number" then
                if check == 0 then
                    guiSetText(self.dom_dniprzedluz_edit"")
                    guiSetText(self.dom_kwotaprzedluz"Kwota ko?cowa: brak danych")
                    self.finalPrice false
                end
                
                guiSetText(self.dom_kwotaprzedluz"Kwota ko?cowa: "..tostring(check).." * $"..tostring(self.currentPrice).." = $"..tostring(check self.currentPrice))
                self.finalPrice check self.currentPrice
                self.finalTime check
            end
            
            if string.len(str) > 3 then
                guiSetText(self.dom_dniprzedluz_edit"")
                guiSetText(self.dom_kwotaprzedluz"Kwota ko?cowa: brak danych")
                self.finalPrice false
            end
        end
        
        for k,v in ipairs(getElementsByType("pickup")) do
            if getElementData(v"dom"then
                local xygetElementPosition(v)
                local x2y2z2 getElementPosition(localPlayer)
                if isLineOfSightClear(xyzx2y2z2truetruefalsetruethen
                    z z+0.5
                    local sxsy getScreenFromWorldPosition(xyz)
                    if sx and sy then
                        local dist getDistanceBetweenPoints3D(xyzx2y2z2)
                        if dist 15 then return end
                        local font_size 1.5-(dist/10)
                        -- rysowanie tekstu
                        local wlasciciel getElementData(v"dom:wlasciciel") or "Brak"
                        local cena getElementData(v"dom:cena") or "0"
                        local garaz getElementData(v"dom:garaz")
                        local time getElementData(v"dom:timestamp")
            
                        
                        if garaz then
                            garaz "Ten dom posiada gara?."
                        else
                            garaz "Ten dom nie posiada gara?u."
                        end
                        
                        if wlasciciel == "Brak" then
                            dxDrawText("Dom do wynaj?cia\nW?a?ciciel: "..wlasciciel.."\nCena za dzie?: $"..cena.."\n"..garazsx+1sy+1sxsytocolor(000200), font_size"default-bold""center")
                            dxDrawText("Dom do wynaj?cia\nW?a?ciciel: "..wlasciciel.."\nCena za dzie?: $"..cena.."\n"..garazsx+2sy+2sxsytocolor(255255255200), font_size"default-bold""center")
                        else
                            local realTimestamp getRealTime().timestamp
                            time getRealTime(time).timestamp
                            if time realTimestamp 0 then return end
                            local days getRealTime(time realTimestamp).yearday
                            local czas_string
                            if days == 0 then
                                czas_string "| Pozosta? mniej ni? jeden dzie? wynaj?cia."
                            elseif days 2 then
                                czas_string "| Pozosta? oko?o "..tostring(days).." dzie? wynaj?cia."
                            else
                                czas_string "| Pozosta?o oko?o "..tostring(days).." dni wynaj?cia."
                            end
                            
                            dxDrawText("Dom wynaj?ty "..czas_string.."\nW?a?ciciel: "..wlasciciel.."\n"..garazsx+1sy+1sxsytocolor(000200), font_size"default-bold""center")
                            dxDrawText("Dom wynaj?ty "..czas_string.."\nW?a?ciciel: "..wlasciciel.."\n"..garazsx+2sy+2sxsytocolor(255255255200), font_size"default-bold""center")
                        end
                    end
                end
            end
        end
    end
    addEventHandler("onClientRender"root, function() object:render() end)
    
    return object;
end
CDomki();


dla informacji, server przedtem wygladal tak:
https://pastebin.com/raw/rqyAu4yW

Podpis

Znajdź mnie na:
Steamie
GitHubie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-17, 20:03


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5


function object:openGarage(garaz)
    local garazyk getElementData(garaz"dom:garaz")
   local id getElementData(garaz"domek:id")
   if garazyk then 
   if id == 11 then 
    moveObject(garazeDayZ.jakis10001353.66, -626.34109.13-10)
end 

sprawdzasz if elementdata domek:id == 11 then
wi?c nic dziwnego ze nie otworzy, jesli twoj dom ma inn? elementdate np domek:id == 1, to nie otworzy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-17, 20:18


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
"satan_" napisał/a:


function object:openGarage(garaz)
    local garazyk getElementData(garaz"dom:garaz")
   local id getElementData(garaz"domek:id")
   if garazyk then 
   if id == 11 then 
    moveObject(garazeDayZ.jakis10001353.66, -626.34109.13-10)
end 

sprawdzasz if elementdata domek:id == 11 then
wi?c nic dziwnego ze nie otworzy, jesli twoj dom ma inn? elementdate np domek:id == 1, to nie otworzy.


O czym ty m?wisz? dom na nadane ID, to co mi da?e? nie zmienia nic, brame ci?gle tworzy?o

Podpis

Znajdź mnie na:
Steamie
GitHubie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-19, 19:14


AmLotte.







Wiek: 21
Na forum: 2184 dni
Posty: 134
Nick w MP: AmLotte

Piwa: 443

Respekt: 50

"Aw4ke" napisał/a:

"satan_" napisał/a:


function object:openGarage(garaz)
    local garazyk getElementData(garaz"dom:garaz")
   local id getElementData(garaz"domek:id")
   if garazyk then 
   if id == 11 then 
    moveObject(garazeDayZ.jakis10001353.66, -626.34109.13-10)
end 

sprawdzasz if elementdata domek:id == 11 then
wi?c nic dziwnego ze nie otworzy, jesli twoj dom ma inn? elementdate np domek:id == 1, to nie otworzy.


O czym ty m?wisz? dom na nadane ID, to co mi da?e? nie zmienia nic, brame ci?gle tworzy?o


Brame mog?o utworzy? to prawda bo to tylko model a tutaj moveObject przeuswasz utworzony model tzncz. w twoim przypadku garazeDayz.jakis, tak?e szatan m?wi dobrze, lepiej sprawdz elementdate domku w kt?rym aktualnie jeste? b?d? masz otwarty panel i wtedy zrobi? if id == 11 then tak jak u ciebie. sp?jrz na id domku w kt?rym chcesz umie?ci? t? mo?liwo??

Postaw piwo autorowi tego posta
 

 
Tagi: brama :: sie :: nie :: otwiera
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku