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

Wysłany: 2018-08-19, 20:02


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

GUIEditor = {
    staticimage = {}
}
    function tuning()
        GUIEditor.staticimage[1] = guiCreateStaticImage(387, 167, 554, 410, ":K_pojazdy-tuning/TLO/tlo.png", true)
        GUIEditor.staticimage[2] = guiCreateStaticImage(29, 24, 138, 134, ":K_pojazdy-tuning/US/ulepszsilnik.png", true) 
        GUIEditor.staticimage[3] = guiCreateStaticImage(390, 24, 139, 136, ":K_pojazdy-tuning/NAPED/AWD.png", true)
        GUIEditor.staticimage[4] = guiCreateStaticImage(30, 254, 137, 135, ":K_pojazdy-tuning/NAPED/FWD.png", true) 
        GUIEditor.staticimage[5] = guiCreateStaticImage(390, 254, 137, 136, ":K_pojazdy-tuning/NAPED/RWD.png", true) 
        GUIEditor.staticimage[6] = guiCreateStaticImage(240, 168, 75, 74, ":K_pojazdy-tuning/EXIT/EXIT.png", true)
    end
marker = createMarker ( -2328.54297, -168.02129, 33.83862, "cylinder", 3.0, 0, 0, 180, 200 )

addEventHandler("onClientMarkerHit", marker, function()
    guiSetVisible(GUIEditor.staticimage[1], true)
    guiSetVisible(GUIEditor.staticimage[2], true)
    guiSetVisible(GUIEditor.staticimage[3], true)
    guiSetVisible(GUIEditor.staticimage[4], true)
    guiSetVisible(GUIEditor.staticimage[5], true)
    guiSetVisible(GUIEditor.staticimage[6], true)
    showCursor(false)
end)


nie wiem jak to zrobi? jak kto? wie to pomo?e kto??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-19, 20:21


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

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

?apaj, licze na piwko i respekcik, powinno dzialac ;p

local screenW, screenH = guiGetScreenSize()
pokaz = false
GUIEditor = {
    staticimage = {}
}
    function tuning()
        GUIEditor.staticimage[1] = guiCreateStaticImage(387, 167, 554, 410, ":K_pojazdy-tuning/TLO/tlo.png", true)
        GUIEditor.staticimage[2] = guiCreateStaticImage(29, 24, 138, 134, ":K_pojazdy-tuning/US/ulepszsilnik.png", true) 
        GUIEditor.staticimage[3] = guiCreateStaticImage(390, 24, 139, 136, ":K_pojazdy-tuning/NAPED/AWD.png", true)
        GUIEditor.staticimage[4] = guiCreateStaticImage(30, 254, 137, 135, ":K_pojazdy-tuning/NAPED/FWD.png", true) 
        GUIEditor.staticimage[5] = guiCreateStaticImage(390, 254, 137, 136, ":K_pojazdy-tuning/NAPED/RWD.png", true) 
        GUIEditor.staticimage[6] = guiCreateStaticImage(240, 168, 75, 74, ":K_pojazdy-tuning/EXIT/EXIT.png", true)
    end
marker = createMarker ( -2328.54297, -168.02129, 33.83862, "cylinder", 3.0, 0, 0, 180, 200 )

addEventHandler("onClientMarkerHit", marker, function()
    guiSetVisible(GUIEditor.staticimage[1], true)
    guiSetVisible(GUIEditor.staticimage[2], true)
    guiSetVisible(GUIEditor.staticimage[3], true)
    guiSetVisible(GUIEditor.staticimage[4], true)
    guiSetVisible(GUIEditor.staticimage[5], true)
    guiSetVisible(GUIEditor.staticimage[6], true)
    showCursor(false)
end)

function pokazuj)
    if pokaz == false then
        addEventHandler ("onClientRender", root, tuning)
    pokaz = true
    else
        removeEventHandler ("onClientRender", root, tuning)
        pokaz = false 
    end
end
bindKey ("F5", "down", tuning)

tu gdzie F5 ustalasz pod jakim przyciskiem gui sie odpala

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-19, 20:46


czlowiekjaja







Wiek: 20
Na forum: 2991 dni
Posty: 76
Nick w MP: czlowiekjaja

Piwa: 324

Respekt: 50

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

tuningmarker1 = createMarker ( -2328.19092, -168.68672, 33.83862, "cylinder", 3, 0, 255, 180 )
tuning_gui1 = false

    function tuningpojazdu()     
        dxDrawImage(323, 151, 697, 443, ":K_pojazdy-tuning/TLO/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(362, 427, 144, 145, ":K_pojazdy-tuning/US/ulepszsilnik.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(524, 426, 144, 145, ":K_pojazdy-tuning/NAPED/AWD.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(842, 425, 144, 146, ":K_pojazdy-tuning/NAPED/FWD.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(684, 426, 144, 145, ":K_pojazdy-tuning/NAPED/RWD.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Witaj w panelu tuningu mechanicznego pojazd?w.\nPoni?ej masz opcje kt?re mo?esz tutaj zamontowa? :)", 501 - 1, 267 - 1, 814 - 1, 309 - 1, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu tuningu mechanicznego pojazd?w.\nPoni?ej masz opcje kt?re mo?esz tutaj zamontowa? :)", 501 + 1, 267 - 1, 814 + 1, 309 - 1, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu tuningu mechanicznego pojazd?w.\nPoni?ej masz opcje kt?re mo?esz tutaj zamontowa? :)", 501 - 1, 267 + 1, 814 - 1, 309 + 1, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu tuningu mechanicznego pojazd?w.\nPoni?ej masz opcje kt?re mo?esz tutaj zamontowa? :)", 501 + 1, 267 + 1, 814 + 1, 309 + 1, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Witaj w panelu tuningu mechanicznego pojazd?w.\nPoni?ej masz opcje kt?re mo?esz tutaj zamontowa? :)", 501, 267, 814, 309, tocolor(58, 58, 58, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawImage(963, 168, 33, 30, ":K_pojazdy-tuning/EXIT/EXIT.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end

addEventHandler("onClientMarkerHit", tuningmarker1, function()
    if tuning_gui1 == false then
        addEventHandler("onClientRender", root, tuningpojazdu)
        showCursor(true)
        tuning_gui1 = true
    end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuning_gui1 == true then
            if isMouseInPosition(963, 168, 33, 30) then
                removeEventHandler("onClientRender", root, tuningpojazdu)
                showCursor(false)
                tuning_gui1 = false
            end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuning_gui1 == true then
            if isMouseInPosition(362, 427, 144, 145) then
                triggerServerEvent("ulepszsilnik", localPlayer)
                removeEventHandler("onClientRender", root, tuningpojazdu)
                showCursor(false)
                tuning_gui1 = false
            end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuning_gui1 == true then
            if isMouseInPosition(524, 426, 144, 145) then
                triggerServerEvent("AWD", localPlayer)
                removeEventHandler("onClientRender", root, tuningpojazdu)
                showCursor(false)
                tuning_gui1 = false
            end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuning_gui1 == true then
            if isMouseInPosition(842, 425, 144, 146) then
                triggerServerEvent("FWD", localPlayer)
                removeEventHandler("onClientRender", root, tuningpojazdu)
                showCursor(false)
                tuning_gui1 = false
            end
addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if tuning_gui1 == true then
            if isMouseInPosition(684, 426, 144, 145) then
                triggerServerEvent("RWD", localPlayer)
                removeEventHandler("onClientRender", root, tuningpojazdu)
                showCursor(false)
                tuning_gui1 = false
            end
        end
    end
end
)
end
end
end
)
end
end
end
)
end
end
end
)
end
end
end
)
end
)

server
addEvent("ulepszslinik", true)
addEventHandler("ulepszsilnik", root, function()
pojazd = getPedOccupiedVehicle(source)
if not pojazd then return end
local money = getPlayerMoney(thePlayer)
if (money > 65000) then 
        takePlayerMoney(source, 65000)
        outputChatBox( "#6699FFPomy?lnie zamontowano ulepszony silnik!", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "maxVelocity", 250.0 )
setVehicleHandling(pojazd, "engineAcceleration", 16.0 )
end

addEvent("AWD", true)
addEventHandler("AWD", root, function()
pojazd = getPedOccupiedVehicle(source)
local money = getPlayerMoney(thePlayer)
if not pojazd then return end
if (money > 65000) then 
        takePlayerMoney(source, 65000)
        outputChatBox( "#6699FFPomy?lnie zamontowano nap?d AWD", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "awd")
end

addEvent("RWD", true)
addEventHandler("RWD", root, function()
pojazd = getPedOccupiedVehicle(source)
local money = getPlayerMoney(thePlayer)
if not pojazd then return end
if (money > 65000) then 
        takePlayerMoney(source, 65000)
        outputChatBox( "#6699FFPomy?lnie zamontowano nap?d RWD", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "rwd")
end

addEvent("FWD", true)
addEventHandler("FWD", root, function()
pojazd = getPedOccupiedVehicle(source)
local money = getPlayerMoney(thePlayer)
if not pojazd then return end
if (money > 65000) then 
        takePlayerMoney(source, 65000)
        outputChatBox( "#6699FFPomy?lnie zamontowano nap?d FWD", getRootElement(), 255, 255, 255, true )
setVehicleHandling(pojazd, "driveType", "fwd")
end
end
)
end
)
end
)
end
)                


zrobi?em to tak i wyskakuje ERROR:Client (czlowiekjaja) triggered serverside event ulepszsilnik, but event is not added serverside

[ Dodano: 2018-08-20, 12:29 ]
dobra uda?o mi si? do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: żeby :: gui :: się :: włączało
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » jak zrobić żeby gui się włączało 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