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

Wysłany: 2017-08-07, 11:33


wojakmati







Wiek: 28
Na forum: 3434 dni
Posty: 8
Nick w MP: AlabamaJustice



Respekt: 36,3

Ostrzeżeń: 80%
witam mam problem z mechem,a mianowicie gdy w wchodze w punkt mam klik?? w auto ale nic si? nie dziejie jak klikam
Oto kod

removeWorldModel(113605, -2038.873046875169.98632812528.839275360107)
removeWorldModel(113595, -2052.7578125150.46289062528.8359375)
removeWorldModel(114165, -2026.716796875129.83007812528.842931747437)
removeWorldModel(113275, -2026.9326171875129.83398437528.842931747437)

local kolizja engineLoadCOL("collision.col")
engineReplaceCOL(kolizja11387)

local punkty = {
{2169.37, -2166.2113.55},
{2168.14, -2164.3813.55},
{2169.14, -2164.3813.55},
}

for i,v in ipairs(punkty) do
    createMarker(v[1], v[2], v[3]-0.9"cylinder"10025575)
end

addEventHandler("onClientMarkerHit"resourceRoot, function(hit) if hit ~= localPlayer then return end setElementData(hit"mechanik"trueshowCursor(truefalsekm true exports["nm-noti"]:noti("Aby w??czy? panel naprawy kliknij na pojazd."end)
addEventHandler("onClientMarkerLeave"resourceRoot, function(hit) if hit ~= localPlayer then return end setElementData(hit"mechanik"falseshowCursor(falsekm false end)

local text "Pojazd jest w niskim stanie techniczym (50%)\nCena naprawy wyniesie 150.15 PLN\nAby naprawi? pojazd Banshee kliknij przycisk 'Napraw'."
local cena false
local pojazd false

local cuboid createColCuboid(2164.82, -2164.4413.551005700050000)
local cuboid2 createColCuboid(2164.82, -2164.4413.551575)


local screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

function mysz(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 text false

local czcionka dxCreateFont(":nm-scoreboard/czcionka.ttf"8)
if not czcionka then czcionka "default-bold" end

function gui()
            exports["nm-blur"]:dxDrawBluredRectangle(screenW 0.3572screenH 0.2813screenW 0.2862screenH 0.2461tocolor(150150150255))
            dxDrawRectangle(screenW 0.3565screenH 0.2786screenW 0.2870screenH 0.0521tocolor(2575125155), false)
            dxDrawText("Panel naprawy pojazd?w", (screenW 0.3565) + 1, (screenH 0.2786) + 1, (screenW 0.6435) + 1, (screenH 0.3307) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText("Panel naprawy pojazd?w"screenW 0.3565screenH 0.2786screenW 0.6435screenH 0.3307tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText(text, (screenW 0.3638) + 1, (screenH 0.3385) + 1, (screenW 0.6318) + 1, (screenH 0.4466) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText(textscreenW 0.3638screenH 0.3385screenW 0.6318screenH 0.4466tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
                    if mysz(screenW 0.3638screenH 0.4570screenW 0.1318screenH 0.0573then
                        dxDrawRectangle(screenW 0.3638screenH 0.4570screenW 0.1318screenH 0.0573tocolor(2575125180), false)
                    else
                        dxDrawRectangle(screenW 0.3638screenH 0.4570screenW 0.1318screenH 0.0573tocolor(2575125125), false)
                    end
                    if mysz(screenW 0.4985screenH 0.4570screenW 0.1332screenH 0.0586then
                        dxDrawRectangle(screenW 0.4985screenH 0.4570screenW 0.1332screenH 0.0586tocolor(2575125180), false)
                    else
                        dxDrawRectangle(screenW 0.4985screenH 0.4570screenW 0.1332screenH 0.0586tocolor(2575125125), false)
                    end
            dxDrawText("Napraw pojazd", (screenW 0.3638) + 1, (screenH 0.4557) + 1, (screenW 0.4956) + 1, (screenH 0.5143) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText("Napraw pojazd"screenW 0.3638screenH 0.4557screenW 0.4956screenH 0.5143tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText("Zamknij panel", (screenW 0.4985) + 1, (screenH 0.4557) + 1, (screenW 0.6318) + 1, (screenH 0.5156) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText("Zamknij panel"screenW 0.4985screenH 0.4557screenW 0.6318screenH 0.5156tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
end


addEventHandler("onClientClick"getRootElement(), function (buttonstate_____cw)
  if not cw or button ~= "left" or state ~= "down" then return end
  if getElementType(cw) ~= "vehicle" then return end
  if isElementWithinColShape(cwcuboid) or isElementWithinColShape(cwcuboid2then
        if not text == false then return end
        if getElementData(localPlayer"mechanik") ~= true then return end
        local zycie getElementHealth(cw)/10
        if zycie == 100 then
            exports["nm-noti"]:noti("Ten pojazd jest sprawny.")
            return
        end
    addEventHandler("onClientPreRender"rootgui)
        local stan "dobrym"

        local zycie getElementHealth(cw)/10
        local grosz math.random(010)

        if zycie and zycie <= 25 then
            cena "500."..grosz
            stan "bardzo niskim"
        elseif zycie 25 and zycie <= 50 then
            cena "350."..grosz
            stan "niskim"
        elseif zycie 50 and zycie <= 75 then
            cena "200."..grosz
            stan "?rednim"
        elseif zycie 75 and zycie <= 85 then
            cena "100."..grosz
            stan "dobrym"
        elseif zycie 85 and zycie <= 100 then
            cena "50."..grosz
            stan "bardzo dobrym"
        end
        cena string.format("%1.2f"cena)

        local nstan string.format("%1d"zycie)

        pojazd cw
        local np getVehicleName(cw)
        text "Pojazd jest w "..stan.." stanie techniczym ("..nstan.."%)\nCena naprawy wyniesie "..cena.." PLN\nAby naprawi? pojazd "..np.." kliknij przycisk 'Napraw'."
        showCursor(truefalse)
  end
end)

addEventHandler("onClientClick"root, function(buttonstate)
    if button ~= "state" and state ~= "down" then return end
    if mysz(screenW 0.3638screenH 0.4570screenW 0.1318screenH 0.0573) and text ~= false then
        local hajs getElementData(localPlayer"pieniadze")
        hajs string.format("%1.2f"hajs)
        hajs tonumber(hajs)
        if hajs tonumber(cenathen
            showCursor(false)
            removeEventHandler("onClientPreRender"rootgui)
            exports["nm-noti"]:noti("Naprawi?e? pojazd "..getVehicleName(pojazd).." za cene "..cena.." PLN.")
            triggerServerEvent("i:napraw"localPlayerpojazd)
            setElementData(localPlayer"pieniadze"hajs-cena)
            text false
        else
            exports["nm-noti"]:noti("Potrzebujesz "..cena.." PLN aby naprawi? pojazd, masz "..hajs.." PLN.")
            showCursor(false)
            text false
            removeEventHandler("onClientPreRender"rootgui)
        end
    elseif mysz(screenW 0.4985screenH 0.4570screenW 0.1332screenH 0.0586) and text ~= false then
        removeEventHandler("onClientPreRender"rootgui)
        showCursor(false)
        text false
    end
end)


Ostatnio zmieniony przez _Haze 2017-08-08, 13:12, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: problem :: mechanikiem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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