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

Wysłany: 2019-03-08, 19:48


killercycDDS

Migacz






Wiek: 26
Na forum: 4653 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1667

Respekt: 22

witam mam problem z panelem poniewa? gdy matuj? mk 1 wszystko ?adnie dzia?a lecz gdy zam?tuj? mk2 to montuj? mi mk 1 i mk2

C

local guis = false

local screenW, screenH = guiGetScreenSize()

    function gui()
        dxDrawText("Panel M?towanie MK", screenW * 0.4380, screenH * 0.2593, (screenW * 0.4380) + 332, ( screenH * 0.2593) + 52, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.4323, screenH * 0.3074, 347, 473, tocolor(3, 72, 199, 155), false)
        dxDrawRectangle(screenW * 0.4688, screenH * 0.3519, 199, 83, tocolor(10, 2, 160, 254), false)
        dxDrawRectangle(screenW * 0.4688, screenH * 0.4787, screenW * 0.1036, screenH * 0.0769, tocolor(10, 2, 160, 254), false)
        dxDrawRectangle(screenW * 0.4688, screenH * 0.6056, screenW * 0.1036, screenH * 0.0769, tocolor(10, 2, 160, 254), false)
        dxDrawText("Zam?tuj MK 1 - X $", screenW * 0.4714, screenH * 0.3556, screenW * 0.5724, screenH * 0.4287, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
        dxDrawText("Zam?tuj MK 2 - X $", screenW * 0.4698, screenH * 0.4824, screenW * 0.5703, screenH * 0.5519, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
        dxDrawText("Zam?tuj MK 3 - X $", screenW * 0.4703, screenH * 0.6120, screenW * 0.5703, screenH * 0.6778, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.5036, screenH * 0.7093, screenW * 0.0333, screenH * 0.0361, tocolor(10, 2, 199, 155), false)
        dxDrawText("X", screenW * 0.5047, screenH * 0.7139, screenW * 0.5349, screenH * 0.7407, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
    end

function mysz( 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 )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

marker = createMarker( -1902.83, 909.35, 35.02-0.9, 'cylinder', 4, 55, 155, 125, 85)


addEventHandler("onClientMarkerHit", marker, function(plr)
local pojazd = getPedOccupiedVehicle(plr)
if not pojazd then return end
if plr ~= localPlayer then return end
if guis == true then
        guis = false
        showCursor(false)
        removeEventHandler("onClientPreRender", root, gui)
    else
        guis = true
        showCursor(true)
        addEventHandler("onClientPreRender", root, gui)
    end
end)


function mk1(button, state)
            if guis and button == "left" and state == "down" then
                if mysz(screenW * 0.4714, screenH * 0.3556, screenW * 0.5724, screenH * 0.4287) then
                triggerServerEvent("mk1xd", localPlayer)
                 end
            end
        end
    addEventHandler("onClientClick", root, mk1)

function mk2(button, state)
            if guis and button == "left" and state == "down" then
                if mysz(screenW * 0.4698, screenH * 0.4824, screenW * 0.5703, screenH * 0.5519) then
                triggerServerEvent("mk2xdd", localPlayer)
                 end
            end
        end
        addEventHandler("onClientClick", root, mk2)

function mk3(button, state)
            if guis and button == "left" and state == "down" then
                if mysz(screenW * 0.4703, screenH * 0.6120, screenW * 0.5703, screenH * 0.6778) then
                triggerServerEvent("mk3xddd", localPlayer)
                 end
            end
        end
        addEventHandler("onClientClick", root, mk3)

        function close(button, state)
            if guis and button == "left" and state == "down" then
                if mysz(screenW * 0.5047, screenH * 0.7139, screenW * 0.5349, screenH * 0.7407) then
                guis = false
                showCursor(false)
                removeEventHandler("onClientPreRender", root, gui)
                 end
            end
        end
        addEventHandler("onClientClick", root, close)


S

cmk1 = 1
cmk2 = 2
cmk3 = 3

local t=createElement("text")
setElementData(t, "name", "Monta? Neon?w.")
setElementPosition(t, -1902.83, 909.35, 35.02)

local licz = {}
addEvent("mk1xd", true)
addEventHandler("mk1xd", root, function(plr)
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
if (getPlayerMoney(source) > tonumber(cmk1)) then
    setElementData(pojazd, "mk1", 1)
    setElementData(pojazd, "vehicle:upgrades", {turbo=true, als=true})
    takePlayerMoney( source, cmk1 )
    outputChatBox("* Pomy?lnie zamontowano MK1. Oddaj pojazd do przecho by by?o wida? efekt dzia?ania", source,true)
    else
     outputChatBox("* Nie sta? Ci? na to.", source,true)
end
end
)

addEvent("mk2xdd", true)
addEventHandler("mk2xdd", root, function(plr)
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
if (getPlayerMoney(source) > tonumber(cmk2)) then
    setElementData(pojazd, "mk2", 1)
    setElementData(pojazd, "vehicle:upgrades", {turbo=true, als=true})
    takePlayerMoney( source, cmk2 )
    outputChatBox("* Pomy?lnie zamontowano MK2. Oddaj pojazd do przecho by by?o wida? efekt dzia?ania", source,true)
    else
     outputChatBox("* Nie sta? Ci? na to.", source,true)
end
end
)

addEvent("mk3xddd", true)
addEventHandler("mk3xddd", root, function(plr)
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
if (getPlayerMoney(source) > tonumber(cmk3)) then
    setElementData(pojazd, "mk3", 1)
    setElementData(pojazd, "vehicle:upgrades", {turbo=true, als=true})
    takePlayerMoney( source, cmk3 )
    outputChatBox("* Pomy?lnie zamontowano MK3. Oddaj pojazd do przecho by by?o wida? efekt dzia?ania", source,true)
    else
     outputChatBox("* Nie sta? Ci? na to.", source,true)
end
end
)


Postaw piwo autorowi tego posta
 

 
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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