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: 2138 dni
Posty: 9
Nick w MP: Wr77zeR



Respekt: 50

mojeW,mojeH 1366768
sW,sH guiGetScreenSize()
w= (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*w165*h583*w377*h":pystories-domy/kupno.png"000tocolor(255255255255), false)
if dom.ownerid then
dxDrawText("Op?&#8218;acanie domu"207*w281*h400*w299*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("OPŁA?&#8224;"240*w461*h367*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
else
dxDrawText("Kupywanie domu"207*w281*h400*w299*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("KUP"240*w461*h367*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
end
dxDrawText("Koszt:"252*w394*h357*w414*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("Czas wynajecia: "208*w321*h400*w340*htocolor(255255255255), 1.00dxfont0_1"center""top"falsefalsefalsefalsefalse)
if isElement(editcostthen
cost=guiGetText(edittime)
if not tonumber(costthen
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(editcostsscost.." PLN")
end
end
if not editing then

dxDrawImage(404*w208*h565*w347*h":pystories-domy/dom.png"000tocolor(255255255255), false)
dxDrawText("Zarz?&#8230;dzanie domem (ID: "..dom.id..")"408*w281*h958*w298*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawRectangle(796*w435*h152*w42*htocolor(000200), false)
dxDrawText("Zamknij"797*w435*h948*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawRectangle(606*w435*h152*w42*htocolor(000200), false)
dxDrawRectangle(419*w435*h152*w42*htocolor(000200), false)
if dom.ownerid then
dxDrawRectangle(434*w408*h127*w16*htocolor(000200), false)
dxDrawRectangle(618*w408*h127*w16*htocolor(000200), false)
dxDrawRectangle(808*w408*h127*w16*htocolor(000200), false)
dxDrawText("Zwolnij dom"997*w407*h745*w424*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("Lokatorzy"617*w407*h745*w424*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("WejdĹş"420*w435*h571*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("Op?&#8218;a?&#8225; dom"607*w435*h758*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
if not dom.zamkniety then
dxDrawText("Zamknij dom"433*w408*h559*w425*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
else
dxDrawText("OtwĂłrz dom"433*w408*h559*w425*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
end
else
dxDrawText("Kup dom"607*w435*h758*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
dxDrawText("Zobacz dom"420*w435*h571*w477*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
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*w329*h933*w380*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
if isMouseIn(419*w435*h152*w42*hthen
dxDrawRectangle(420*w477*h151*w2*htocolor(255,79,10), false)
else
dxDrawRectangle(420*w477*h151*w2*htocolor(255255255200), false)
end
if isMouseIn(606*w435*h152*w42*hthen
dxDrawRectangle(607*w477*h151*w2*htocolor(255,79,10), false)
else
dxDrawRectangle(607*w477*h151*w2*htocolor(255255255200), false)
end
if isMouseIn(796*w435*h152*w42*hthen
dxDrawRectangle(797*w477*h151*w2*htocolor(255,79,10), false)
else
dxDrawRectangle(797*w477*h151*w2*htocolor(255255255200), false)
end
else
dxDrawRectangle(572*w260*h223*w215*htocolor(255,79,10), false)
dxDrawText("Lokatorzy"572*w260*h795*w278*htocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
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"573279795370tocolor(255255255255), 1.00dxfont0_1"center""center"falsefalsefalsefalsefalse)
if isElement(editthen
local text=guiGetText(edit)
guiSetText(editstring.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(elthen
    local dom2=getElementData(source,"dom")
    if not dom2 then return end
        if dom then return end
        dom=dom2
        addEventHandler("onClientRender"rootrender)
        addEventHandler("onClientClick"rootclick)
        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*w435*h152*w42*hthen
        domWejscie()
    elseif isMouseIn(796*w435*h152*w42*h) and not editing then
        removeEventHandler("onClientRender"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        showCursor(false)
        if isElement(editcostthen
        editcost:destroy()
        end
        if isElement(edittimethen
        edittime:destroy()
        end
        if isElement(btn1then
        btn1:destroy()
        end
        if isElement(btn2then
        btn2:destroy()
        end
        if isElement(btn3then
        btn3:destroy()
        end
        if isElement(editthen
        edit:destroy()
        end
    elseif isMouseIn(606*w435*h152*w42*h) and not editing then
        if isElement(editcostthen
            editcost:destroy()
            edittime:destroy()
            kupywanie=false
        else
            editcost GuiEdit(250*w419*h107*w20*h"0 PLN"false)
            guiEditSetReadOnly(editcosttrue)
            edittime GuiEdit(250*w350*h107*w20*h""false)
            guiEditSetMaxLength(edittime2)
            kupywanie=true
        end
    elseif isMouseIn(240*w461*h127*w16*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"localPlayerguiGetText(edittime), dom.id)
        removeEventHandler("onClientRender"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        showCursor(false)
        editcost:destroy()
        edittime:destroy()
        kupywanie=false
    elseif isMouseIn(240*w461*h127*w16*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"localPlayerguiGetText(edittime), dom.id)
        removeEventHandler("onClientRender"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        showCursor(false)
        editcost:destroy()
        edittime:destroy()
        kupywanie=false
    elseif isMouseIn(434*w408*h127*w16*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"resourceRootdom.id"zamkniety"not dom.zamkniety)
        removeEventHandler("onClientRender"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        showCursor(false)
        if isElement(editcostthen
        editcost:destroy()
        end
        if isElement(edittimethen
        edittime:destroy()
        end
        if isElement(btn1then
        btn1:destroy()
        end
        if isElement(btn2then
        btn2:destroy()
        end
        if isElement(btn3then
        btn3:destroy()
        end
        if isElement(editthen
        edit:destroy()
        end
    elseif isMouseIn(808*w408*h127*w16*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"localPlayerdom.id)
        removeEventHandler("onClientRender"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        showCursor(false)
        if isElement(editcostthen
        editcost:destroy()
        end
        if isElement(edittimethen
        edittime:destroy()
        end
        if isElement(btn1then
        btn1:destroy()
        end
        if isElement(btn2then
        btn2:destroy()
        end
        if isElement(btn3then
        btn3:destroy()
        end
        if isElement(editthen
        edit:destroy()
        end
    elseif isMouseIn(618*w408*h127*w16*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(editcostthen
        editcost:destroy()
        end
        if isElement(edittimethen
        edittime:destroy()
        end
        if isElement(btn1then
        btn1:destroy()
        end
        if isElement(btn2then
        btn2:destroy()
        end
        if isElement(btn3then
        btn3:destroy()
        end
        if isElement(editthen
        edit:destroy()
        end
        btn1 GuiButton(589*w391*h41*w30*h"Dodaj"false)
        btn2 GuiButton(739*w391*h41*w30*h"Usu?&#8222;"false)
        btn3 GuiButton(642*w443*h87*w25*h"PowrĂłt"false)
        edit GuiEdit(640*w395*h89*w20*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(textthen 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+"localPlayertextdom.id)
                removeEventHandler("onClientRender"rootrender)
                removeEventHandler("onClientClick"rootclick)
                dom=nil
                showCursor(false)
                if isElement(editcostthen
                editcost:destroy()
                end
                if isElement(edittimethen
                edittime:destroy()
                end
                if isElement(btn1then
                btn1:destroy()
                end
                if isElement(btn2then
                btn2:destroy()
                end
                if isElement(btn3then
                btn3:destroy()
                end
                if isElement(editthen
                edit:destroy()
                end
            end
        end)
        addEventHandler("onClientGUIClick"btn2, function(btn)
            if btn=="left" then
                local text=guiGetText(edit)
                if not tonumber(textthen return end
                if tonumber(text) ~= and tonumber(text) ~= and tonumber(text) ~= 3 then exports.noti:showBox("info","Musisz wybra?&#8225; lokatora!") return end
                triggerServerEvent("DOM:lokator-"localPlayertonumber(text), dom.id)
                removeEventHandler("onClientRender"rootrender)
                removeEventHandler("onClientClick"rootclick)
                dom=nil
                showCursor(false)
                if isElement(editcostthen
                editcost:destroy()
                end
                if isElement(edittimethen
                edittime:destroy()
                end
                if isElement(btn1then
                btn1:destroy()
                end
                if isElement(btn2then
                btn2:destroy()
                end
                if isElement(btn3then
                btn3:destroy()
                end
                if isElement(editthen
                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"rootrender)
        removeEventHandler("onClientClick"rootclick)
        dom=nil
        editing=false
        showCursor(false)
        if isElement(editcostthen
        editcost:destroy()
        end
        if isElement(edittimethen
        edittime:destroy()
        end
        if isElement(btn1then
        btn1:destroy()
        end
        if isElement(btn2then
        btn2:destroy()
        end
        if isElement(btn3then
        btn3:destroy()
        end
        if isElement(editthen
        edit:destroy()
        end
    end
end)

function domWejscie()
    if not dom then return end
    local dbid=dbid(localPlayer)
    removeEventHandler("onClientRender"rootrender)
    removeEventHandler("onClientClick"rootclick)
    showCursor(false)
    if isElement(editcostthen
    editcost:destroy()
    end
    if isElement(edittimethen
    edittime:destroy()
    end
    if isElement(btn1then
    btn1:destroy()
    end
    if isElement(btn2then
    btn2:destroy()
    end
    if isElement(btn3then
    btn3:destroy()
    end
    if isElement(editthen
    edit:destroy()
    end
    kupywanie=false
    if not dom.ownerid then
        ad=dom
        triggerServerEvent("moveMeTo"resourceRootdom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interiordom.dimension)
        setTimer(function(d,p)
            if (getElementDimension(localPlayer)==dthen
                triggerServerEvent("moveMeTo"resourceRootp[1], p[2], p[3], 0,0)
            end
        end30000,1,ad.dimensionad.exit_loc)
    elseif not dom.zamkniety or dom.ownerid==dbid or czyGraczJestLokatorem() then
        triggerServerEvent("moveMeTo"resourceRootdom.interior_loc[1], dom.interior_loc[2], dom.interior_loc[3], dom.interiordom.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: 4428 dni
Posty: 3410

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: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

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: 2138 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