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

Wysłany: 2020-11-24, 17:12


AsaXx







Wiek: 21
Na forum: 2553 dni
Posty: 74
Nick w MP: AsaXx

Piwa: 413

Respekt: 50

Siema! Napotka?em ostatnio taki problem(?). Mianowicie - stworzy?em sobie gui bankomatu, i wszystko fajniutko pi?kniutko, ale gui si? odpala w ka?dym markerze, niezale?nie w jakim skrypcie jest. :| Jakie? pomys?y, bo moje si? sko?cz?y? :)

local bankomaty={
    --x,y,z, rx, ry, rz, INT, DIM,
    
    --[[BANKOMATY LOS SANTOS
    {2194.30, -1971.70, 13.78-0.35, -0.00, 0.00, 177.89}, -- Praca Smieciarki.
    {2110.01, -2100.33, 13.55-0.35, -0.00, 0.00, 359.49}, -- Salon obok ?mieciarek.
    {872.86, -1203.87, 16.98-0.35, -0.00, 0.00, 0.30}, -- Salon w Vinewood obok LSPD na PRL.
    {2133.30, -1151.32, 24.08-0.35, -0.00, 0.00, 179.41}, -- Salon Motorniczy obok Gangu Blood na PRL. (( Jak jeszcze istnieje. ))
    {661.36, -576.13, 16.34-0.35, -0.00, 0.00, 269.16}, -- Stacja Benzynowa Dillimore | Red County.
    --BANKOMATY LOS SANTOS--]]
    
    --BANKOMATY SAN FIERRO
    {-1914.99, 872.88, 35.41-0.35, -0.00, 0.00, 270.16}, -- Spawn.
    {-1915.00, 893.88, 35.41-0.35, -0.00, 0.00, 268.96}, -- Spawn.
    {-1859.65, -145.76, 11.91-0.35, -0.00, 0.00, 180.49}, -- Praca Sweepery.
    {-2032.97, 162.65, 29.04-0.35, -0.00, 0.00, 90.50}, -- Mechanik Doherty.
    {-1964.86, 291.72, 35.47-0.35, -0.00, 0.00, 89.13}, -- Salon Doherty.
    {-1712.48, 399.23, 7.42-0.35, -0.00, 0.00, 223.78}, -- Praca Cysterny.
    {-1648.90, 1202.50, 7.25-0.35, -0.00, 0.00, 180.47}, -- Salon Downtown.
    {-1603.62, 710.27, 13.87-0.35, -0.00, 0.00, 178.86}, -- Komenda G??wna Policji.
    {-1971.48, 620.47, 35.17-0.35, -0.00, 0.00, 0.40}, -- Przechowalnia Pojazd?w.
    {-2102.42, 0.52, 35.32-0.35, -0.00, 0.00, 179.26}, -- Pa?stwowa Stra? Po?arna.
    {-2271.49, -132.45, 35.32-0.35, -0.00, 0.00, 359.55}, -- Tuner Garcia.
    {-2420.15, 983.44, 45.30-0.35, -0.00, 0.00, 90.56}, -- Stacja Juniper Hollow.
    {-1874.00, -219.98, 18.38-0.35, -0.00, 0.00, 88.42}, -- Parking Policyjny Doherty.
    {-2637.05, 632.15, 14.45-0.35, -0.00, 0.00, 269.96}, -- Pogotowie Ratunkowe
    --BANKOMATY SAN FIERRO
    
    --BANKOMATY FORT CARSON
    {-134.66, 1087.23, 19.74-0.35, -0.00, 0.00, 269.76},
    {-205.19, 1135.14, 19.74-0.35, -0.00, 0.00, 89.84},
    {180.66, 655.19, 3.85-0.35, -0.00, 0.00, 12.65},
    {302.23, 1139.31, 8.59-0.35, -0.00, 0.00, 89.60},
    --{},
    --{},
    --{},
    --{},
    --{},
    --{},
    --{},
    --{},
    --{},
    --BANKOMATY FORT CARSON
    
    }
    
    for i,v in ipairs(bankomaty) do
    
        v.obiekt=createObject(2942,v[1],v[2],v[3],v[4],v[5],v[6])
        setElementInterior(v.obiekt,v[7] or 0)
        setElementDimension(v.obiekt,v[8] or 0)
        setElementFrozen(v.obiekt,true)
        setObjectBreakable ( v.obiekt, false )
        
    --    v.mapicon=createBlip(v[1],v[2],v[3], 52, 2, 255,255,255,0, -1000, 300)
        v.mapicon=createBlip(v[1],v[2],v[3], 52, 1, 5,255,5,255, -1000, 275)
        v.markers=createMarker ( v[1], v[2], v[3]-0.9, "checkpoint", 1.5, 255, 255, 0, 170 )
        --local x,y,z = getElementPosition(v.obiekt)
        --exports.customblips:createCustomBlip( x, y, 20, 20, "52.png" )
        setElementInterior(v.obiekt,v[7] or 0)
        setElementDimension(v.obiekt,v[8] or 0)
        
        v.cs=createColSphere(v[1],v[2],v[3]+1, 1)
        setElementInterior(v.cs,v[7] or 0)
        setElementDimension(v.cs,v[8] or 0)
        v.text=createElement('text')
        setElementData(v.text,"name","Bankomat")
        setElementPosition(v.text,v[1],v[2],v[3])
    end

--setElementData(markers, "typ", "bank")

screenW, screenH = guiGetScreenSize()
sx,sy= guiGetScreenSize()
px,py=(sx/1280), (sy/768)

local sw,sh = guiGetScreenSize()
local scale = 1280 / sw

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    
    return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end

panel = false
page = info
blur = false

local font3 = dxCreateFont("Roboto-Regular.ttf", 9)
local font4 = dxCreateFont("Roboto-Regular.ttf", 10)
local font5 = dxCreateFont("Roboto-Regular.ttf", 12)

function przecinek(liczba)  
    local format = liczba  
    while true do      
        format, k = string.gsub(format, "^(-?%d+)(%d%d%d)", '%1,%2')    
        if ( k==0 ) then      
            break  
        end  
    end  
    return format
  end

function gui()
    dxDrawRectangle(475/scale, 200/scale, 325/scale, 375/scale, tocolor(16, 16, 16, 245))
    if isMouseInPosition(573/scale, 479/scale, 125/scale, 17/scale) then
        dxDrawRectangle(573/scale, 479/scale, 125/scale, 17/scale, tocolor(10, 10, 10, 245))
    elseif isMouseInPosition(573/scale, 516/scale, 125/scale, 17/scale) then
        dxDrawRectangle(573/scale, 516/scale, 125/scale, 17/scale, tocolor(10, 10, 10, 245))
    end
    dxDrawText("Bankomat", 945/scale, 50/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font5, "center", "center", false, false, false, false, false)
    dxDrawText("Tw?j stan konta: 0", 945/scale, 175/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font4, "center", "center", false, false, false, false, false)
    dxDrawText("Wybierz kwot? jak? chcesz wyp?aci?", 945/scale, 275/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font4, "center", "center", false, false, false, false, false)
    dxDrawText("10,000", 770/scale, 350/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font3, "center", "center", false, false, false, false, false)
    dxDrawText("100,000", 945/scale, 350/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font3, "center", "center", false, false, false, false, false)
    dxDrawText("1,000,000", 1125/scale, 350/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font3, "center", "center", false, false, false, false, false)
    dxDrawText("Wyp?a?", 945/scale, 550/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font4, "center", "center", false, false, false, false, false)
    dxDrawText("Zamknij", 945/scale, 625/scale, 325/scale, 425/scale, tocolor(188, 200, 204), 1, font4, "center", "center", false, false, false, false, false)
end

--local marker = createMarker ( -1908.06, 895.53, 35.17, "cylinder", 1.5, 255, 255, 0, 170 )

function on(plr)
    if panel == false then 
        if plr == localPlayer then
            panel = true
            addEventHandler("onClientRender",root,gui)
            editBox = guiCreateEdit( 0.41/scale, 0.53/scale, 0.18/scale, 0.025/scale, "W?asna kwota", true )
            --guiSetVisible(editBox,true)
            showCursor(true)
            showChat(false)
        end
    end
end
addEventHandler("onClientMarkerHit", root, on, markers)

function off()
    if panel == true then
        if isMouseInPosition(573/scale, 516/scale, 125/scale, 17/scale) then
            panel = false
            guiSetVisible(editBox,false)
            removeEventHandler("onClientRender",root,gui)
            showCursor(false)
            showChat(true)
        end
    end 
end
addEventHandler("onClientClick", root, off)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-24, 17:25


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Podczas tworzenia eventu "onClientMarkerHit" jako element (source) w drugim argumencie addEventHandler wstaw "resourceRoot".


Więcej informacji znajdziesz w Wikipedii MTA:

Predefined variables list


Postaw piwo autorowi tego posta
 

 
Tagi: markery :: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » markery i gui Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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