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

Wysłany: 2020-08-03, 13:27


Wr77zer







Wiek: 20
Na forum: 2280 dni
Posty: 9
Nick w MP: Wr77zeR



Respekt: 50

mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
sx,sy=guiGetScreenSize()
local dxfont0_1 = dxCreateFont(":dG-Fonty/1.ttf", 10)

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local dom=nil

function dbid(plr)
    local c=getElementData(plr,"player:sid")
    if not c then return nil end
    return tonumber(c)
end

function render()
if kupywanie then
        dxDrawImage(189*w, 165*h, 583*w, 377*h, ":pystories-domy/kupno.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
if dom.ownerid then
dxDrawText("Op?&#8218;acanie domu", 207*w, 281*h, 400*w, 299*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("OPŁA?&#8224;", 240*w, 461*h, 367*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
else
dxDrawText("Kupywanie domu", 207*w, 281*h, 400*w, 299*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("KUP", 240*w, 461*h, 367*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
end
dxDrawText("Koszt:", 252*w, 394*h, 357*w, 414*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("Czas wynajecia: ", 208*w, 321*h, 400*w, 340*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "top", false, false, false, false, false)
if isElement(editcost) then
cost=guiGetText(edittime)
if not tonumber(cost) then
cost=0
end
if string.len(tostring(cost)) < 1 then
cost=0
end
if tonumber(cost) < 1 then
cost=0
end
sscost=cost*dom.koszt
guiSetText(editcost, sscost.." PLN")
end
end
if not editing then

dxDrawImage(404*w, 208*h, 565*w, 347*h, ":pystories-domy/dom.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText("Zarz?&#8230;dzanie domem (ID: "..dom.id..")", 408*w, 281*h, 958*w, 298*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawRectangle(796*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
dxDrawText("Zamknij", 797*w, 435*h, 948*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawRectangle(606*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
dxDrawRectangle(419*w, 435*h, 152*w, 42*h, tocolor(0, 0, 0, 200), false)
if dom.ownerid then
dxDrawRectangle(434*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
dxDrawRectangle(618*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
dxDrawRectangle(808*w, 408*h, 127*w, 16*h, tocolor(0, 0, 0, 200), false)
dxDrawText("Zwolnij dom", 997*w, 407*h, 745*w, 424*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("Lokatorzy", 617*w, 407*h, 745*w, 424*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("WejdĹş", 420*w, 435*h, 571*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("Op?&#8218;a?&#8225; dom", 607*w, 435*h, 758*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
if not dom.zamkniety then
dxDrawText("Zamknij dom", 433*w, 408*h, 559*w, 425*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
else
dxDrawText("OtwĂłrz dom", 433*w, 408*h, 559*w, 425*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
end
else
dxDrawText("Kup dom", 607*w, 435*h, 758*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("Zobacz dom", 420*w, 435*h, 571*w, 477*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
end
if dom.paidTo then
oplacony="Dom jest op?&#8218;acony do "..dom.paidTo.." ("..dom.paidTo_dni.." dni)"
else
oplacony="Dom jest op?&#8218;acony do - - (0 dni)."
end
dxDrawText("Koszt jednej doby wynosi: "..dom.koszt.." PLN\nW?&#8218;a?&#8250;ciciel: "..(dom.owner_nick or "do wynaj?&#8482;cia").."\n"..oplacony.."", 434*w, 329*h, 933*w, 380*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
if isMouseIn(419*w, 435*h, 152*w, 42*h) then
dxDrawRectangle(420*w, 477*h, 151*w, 2*h, tocolor(255,79,10), false)
else
dxDrawRectangle(420*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
end
if isMouseIn(606*w, 435*h, 152*w, 42*h) then
dxDrawRectangle(607*w, 477*h, 151*w, 2*h, tocolor(255,79,10), false)
else
dxDrawRectangle(607*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
end
if isMouseIn(796*w, 435*h, 152*w, 42*h) then
dxDrawRectangle(797*w, 477*h, 151*w, 2*h, tocolor(255,79,10), false)
else
dxDrawRectangle(797*w, 477*h, 151*w, 2*h, tocolor(255, 255, 255, 200), false)
end
else
dxDrawRectangle(572*w, 260*h, 223*w, 215*h, tocolor(255,79,10), false)
dxDrawText("Lokatorzy", 572*w, 260*h, 795*w, 278*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
dxDrawText("1: "..(dom.lokator1 or "brak").."\n2: "..(dom.lokator2 or "brak").."\n3: "..(dom.lokator3 or "brak").."\nAby usun?&#8230;?&#8225; lokatora podaj numer\nwymieniony wyĹĽej, natomiast je?&#8250;li\nchcesz doda?&#8225; lokatora podaj jego sid", 573, 279, 795, 370, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, false, false, false, false)
if isElement(edit) then
local text=guiGetText(edit)
guiSetText(edit, string.gsub(text, '[^0-9]', '' ))
end
end
end

addEventHandler("onClientColShapeHit", resourceRoot, function(el,md)
    if el~=localPlayer or not md then return end
    if getElementType(el) == "player" and not getPedOccupiedVehicle(el) then
    local dom2=getElementData(source,"dom")
    if not dom2 then return end
        if dom then return end
        dom=dom2
        addEventHandler("onClientRender", root, render)
        addEventHandler("onClientClick", root, click)
        showCursor(true)
        kupywanie=false
        editing=false
    end
end)

function czyGraczJestLokatorem()
if dom then
    if dom.lokator1sid==localPlayer:getData("player:sid") or dom.lokator2sid==localPlayer:getData("player:sid") or dom.lokator3sid==localPlayer:getData("player:sid") then
        return true
    else
        return false
    end
end
end

function click(btn,state)
if btn=="left" and state=="down" then
    if isMouseIn(419*w, 435*h, 152*w, 42*h) then
        domWejscie()
    elseif isMouseIn(796*w, 435*h, 152*w, 42*h) and not editing then
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        showCursor(false)
        if isElement(editcost) then
        editcost:destroy()
        end
        if isElement(edittime) then
        edittime:destroy()
        end
        if isElement(btn1) then
        btn1:destroy()
        end
        if isElement(btn2) then
        btn2:destroy()
        end
        if isElement(btn3) then
        btn3:destroy()
        end
        if isElement(edit) then
        edit:destroy()
        end
    elseif isMouseIn(606*w, 435*h, 152*w, 42*h) and not editing then
        if isElement(editcost) then
            editcost:destroy()
            edittime:destroy()
            kupywanie=false
        else
            editcost = GuiEdit(250*w, 419*h, 107*w, 20*h, "0 PLN", false)
            guiEditSetReadOnly(editcost, true)
            edittime = GuiEdit(250*w, 350*h, 107*w, 20*h, "", false)
            guiEditSetMaxLength(edittime, 2)
            kupywanie=true
        end
    elseif isMouseIn(240*w, 461*h, 127*w, 16*h) and kupywanie and dom and not dom.ownerid and not editing then
        triggerEvent('onClientAddNotification', localPlayer, 'Dom musi by?&#8225; op?&#8218;acony za minimum 1 PLN', 'info')
        triggerServerEvent("DOMY:kup", localPlayer, guiGetText(edittime), dom.id)
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        showCursor(false)
        editcost:destroy()
        edittime:destroy()
        kupywanie=false
    elseif isMouseIn(240*w, 461*h, 127*w, 16*h) and kupywanie and dom and dom.ownerid and not editing then
        if dom.ownerid ~= localPlayer:getData("player:sid") then
            triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
            return
        end
        --triggerEvent('onClientAddNotification', localPlayer, 'Koszt domu nie moĹĽe by?&#8225; mniejszy niĹĽ 1 PLN', 'info')
        triggerServerEvent("DOMY:oplac", localPlayer, guiGetText(edittime), dom.id)
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        showCursor(false)
        editcost:destroy()
        edittime:destroy()
        kupywanie=false
    elseif isMouseIn(434*w, 408*h, 127*w, 16*h) and dom.ownerid and not editing then
        if dom.ownerid ~= localPlayer:getData("player:sid") and not czyGraczJestLokatorem() then
            triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
            return
        end
        triggerServerEvent("onHouseChangeOptions", resourceRoot, dom.id, "zamkniety", not dom.zamkniety)
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        showCursor(false)
        if isElement(editcost) then
        editcost:destroy()
        end
        if isElement(edittime) then
        edittime:destroy()
        end
        if isElement(btn1) then
        btn1:destroy()
        end
        if isElement(btn2) then
        btn2:destroy()
        end
        if isElement(btn3) then
        btn3:destroy()
        end
        if isElement(edit) then
        edit:destroy()
        end
    elseif isMouseIn(808*w, 408*h, 127*w, 16*h) and dom.ownerid and not editing then
        if dom.ownerid ~= localPlayer:getData("player:sid") then
            triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
            return
        end
        triggerServerEvent("DOM:zwolnij", localPlayer, dom.id)
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        showCursor(false)
        if isElement(editcost) then
        editcost:destroy()
        end
        if isElement(edittime) then
        edittime:destroy()
        end
        if isElement(btn1) then
        btn1:destroy()
        end
        if isElement(btn2) then
        btn2:destroy()
        end
        if isElement(btn3) then
        btn3:destroy()
        end
        if isElement(edit) then
        edit:destroy()
        end
    elseif isMouseIn(618*w, 408*h, 127*w, 16*h) and not editing and dom.ownerid then
        if dom.ownerid ~= localPlayer:getData("player:sid") then
            triggerEvent('onClientAddNotification', localPlayer, 'Brak uprawnien!', 'info')
            return
        end
        editing=true
        kupywanie=false
        if isElement(editcost) then
        editcost:destroy()
        end
        if isElement(edittime) then
        edittime:destroy()
        end
        if isElement(btn1) then
        btn1:destroy()
        end
        if isElement(btn2) then
        btn2:destroy()
        end
        if isElement(btn3) then
        btn3:destroy()
        end
        if isElement(edit) then
        edit:destroy()
        end
        btn1 = GuiButton(589*w, 391*h, 41*w, 30*h, "Dodaj", false)
        btn2 = GuiButton(739*w, 391*h, 41*w, 30*h, "Usu?&#8222;", false)
        btn3 = GuiButton(642*w, 443*h, 87*w, 25*h, "PowrĂłt", false)
        edit = GuiEdit(640*w, 395*h, 89*w, 20*h, "", false)
        addEventHandler("onClientGUIClick", btn3, function(btn)
            if btn=="left" then
                editing=false
                btn1:destroy()
                btn2:destroy()
                btn3:destroy()
                edit:destroy()
            end
        end)
        addEventHandler("onClientGUIClick", btn1, function(btn)
            if btn=="left" then
                local text=guiGetText(edit)
                if not tonumber(text) then return end
                if dom.lokator1sid == text or dom.lokator2sid == text or dom.lokator3sid == text then
                triggerEvent('onClientAddNotification', localPlayer, 'Jest juz zapisany ten lokator!', 'info')
                    return
                end
                if tonumber(text) == tonumber(localPlayer:getData("player:sid")) then
                triggerEvent('onClientAddNotification', localPlayer, 'Nie mozesz dodac siebie!', 'info')
                    return
                end
                triggerServerEvent("DOM:lokator+", localPlayer, text, dom.id)
                removeEventHandler("onClientRender", root, render)
                removeEventHandler("onClientClick", root, click)
                dom=nil
                showCursor(false)
                if isElement(editcost) then
                editcost:destroy()
                end
                if isElement(edittime) then
                edittime:destroy()
                end
                if isElement(btn1) then
                btn1:destroy()
                end
                if isElement(btn2) then
                btn2:destroy()
                end
                if isElement(btn3) then
                btn3:destroy()
                end
                if isElement(edit) then
                edit:destroy()
                end
            end
        end)
        addEventHandler("onClientGUIClick", btn2, function(btn)
            if btn=="left" then
                local text=guiGetText(edit)
                if not tonumber(text) then return end
                if tonumber(text) ~= 1 and tonumber(text) ~= 2 and tonumber(text) ~= 3 then exports.noti:showBox("info","Musisz wybra?&#8225; lokatora!") return end
                triggerServerEvent("DOM:lokator-", localPlayer, tonumber(text), dom.id)
                removeEventHandler("onClientRender", root, render)
                removeEventHandler("onClientClick", root, click)
                dom=nil
                showCursor(false)
                if isElement(editcost) then
                editcost:destroy()
                end
                if isElement(edittime) then
                edittime:destroy()
                end
                if isElement(btn1) then
                btn1:destroy()
                end
                if isElement(btn2) then
                btn2:destroy()
                end
                if isElement(btn3) then
                btn3:destroy()
                end
                if isElement(edit) then
                edit:destroy()
                end
            end
        end)        
    end
end
end

addEventHandler("onClientColShapeLeave", resourceRoot, function(el,md)
    if el~=localPlayer then return end
    if dom ~= nil then
        removeEventHandler("onClientRender", root, render)
        removeEventHandler("onClientClick", root, click)
        dom=nil
        editing=false
        showCursor(false)
        if isElement(editcost) then
        editcost:destroy()
        end
        if isElement(edittime) then
        edittime:destroy()
        end
        if isElement(btn1) then
        btn1:destroy()
        end
        if isElement(btn2) then
        btn2:destroy()
        end
        if isElement(btn3) then
        btn3:destroy()
        end
        if isElement(edit) then
        edit:destroy()
        end
    end
end)

function domWejscie()
    if not dom then return end
    local dbid=dbid(localPlayer)
    removeEventHandler("onClientRender", root, render)
    removeEventHandler("onClientClick", root, click)
    showCursor(false)
    if isElement(editcost) then
    editcost:destroy()
    end
    if isElement(edittime) then
    edittime:destroy()
    end
    if isElement(btn1) then
    btn1:destroy()
    end
    if isElement(btn2) then
    btn2:destroy()
    end
    if isElement(btn3) then
    btn3:destroy()
    end
    if isElement(edit) then
    edit:destroy()
    end
    kupywanie=false
    if not dom.ownerid then
        ad=dom
        triggerServerEvent("moveMeTo", resourceRoot, dom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interior, dom.dimension)
        setTimer(function(d,p)
            if (getElementDimension(localPlayer)==d) then
                triggerServerEvent("moveMeTo", resourceRoot, p[1], p[2], p[3], 0,0)
            end
        end, 30000,1,ad.dimension, ad.exit_loc)
    elseif not dom.zamkniety or dom.ownerid==dbid or czyGraczJestLokatorem() then
        triggerServerEvent("moveMeTo", resourceRoot, dom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interior, dom.dimension)

    elseif dom.zamkniety then
        triggerEvent("onAnnouncement3",root,"Zamkni?&#8482;te", 3)
    end
    dom=nil
end

local function domOpcje()    
end 


[ Dodano: 2020-08-03, 13:29 ]
tutaj wy?ej masz kod i jeszcze ss bo zmienilem skrypt jagby kolega mi dal i powiedzial ze dziala ale nie dziala dalej i to jest kod domy_c.lua https://imgur.com/a/hFWwkrz

Ostatnio zmieniony przez Wilq 2020-08-03, 14:01, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-03, 14:03


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Wska? linijke 16 i 17, z tych b??d?w co wkleiles na poprzedniej stronie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-03, 14:10


TheSebaPL

Mod-team






Wiek: 22
Na forum: 3239 dni
Posty: 964

Piwa: 3101

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

Wr77zer, a jaki jest konkretnie problem ? Poka? b??dy z debugscript 3 je?eli s? takie to wska? linijki.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-05, 08:43


Wr77zer







Wiek: 20
Na forum: 2280 dni
Posty: 9
Nick w MP: Wr77zeR



Respekt: 50

"TheSebaPL" napisał/a:

Wr77zer, a jaki jest konkretnie problem ? Poka? b??dy z debugscript 3 je?eli s? takie to wska? linijki.



No taki problem ?e jak tworze dom /dom [id] [nazwa domu] to on sie niby tworzy piszcze na chacie i w bazie danych te? jest ale w grze go nie ma ten blip taki gdzie powinie? by? taki zielony domek po prostu go nie ma

Postaw piwo autorowi tego posta
 

 
Tagi: naprawione
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Naprawione 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