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

Wysłany: 2019-02-20, 21:04


smigi







Wiek: 23
Na forum: 3508 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

witam chcia?bym tutaj dodac rosline je?li zaczynasz prace pokazuje marker a ja chce zeby pokazywa?o rosline pomoze ktos wstawiam piwko

local startPracy =  createMarker(1146.74, -2141.34, 68.76-0.9, "cylinder", 1.5)
createBlipAttachedTo(startPracy, 46)

local punktyOgrodnik = {
    {1134.43, -2139.99, 70.32-0.9},
    {1147.27, -2091.87, 70.59-0.9},
    {1143.32, -2081.57, 69.12-0.9},
    {1127.85, -2061.80, 69.01-0.9},
    {1042.80, -2185.93, 40.34-0.9},
    {1036.30, -2191.96, 39.51-0.9},
    {1085.50, -2233.60, 47.50-0.9},
}

x,y = guiGetScreenSize()
px, py = (x/1024), (y/768)

local mousePoints = {
{246*px, 387*py, 15*px, 15*px},
{276*px, 370*py, 15*px, 15*px},
{302*px, 377*py, 15*px, 15*px},
{342*px, 377*py, 15*px, 15*px},
{372*px, 360*py, 15*px, 15*px},
{402*px, 387*py, 15*px, 15*px},
{432*px, 387*py, 15*px, 15*px},
{442*px, 365*py, 15*px, 15*px},
{478*px, 365*py, 15*px, 15*px},
{498*px, 383*py, 15*px, 15*px},
{549*px, 366*py, 15*px, 15*px},
{569*px, 373*py, 15*px, 15*px},
{589*px, 383*py, 15*px, 15*px},
{595*px, 356*py, 15*px, 15*px},
{629*px, 373*py, 15*px, 15*px},
{649*px, 373*py, 15*px, 15*px},
{679*px, 390*py, 15*px, 15*px},
{699*px, 373*py, 15*px, 15*px},
{729*px, 363*py, 15*px, 15*px},
{759*px, 373*py, 15*px, 15*px},
{779*px, 373*py, 15*px, 15*px},
}
target=0
addEventHandler("onClientMarkerHit", startPracy, function(h)
    if h ~= localPlayer then return end
    if isPedInVehicle(localPlayer) then return end
    setElementData(localPlayer, "praca:ogrodnik:gui", true)
    showCursor(true)
end)

function isMouseIn ( 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

setElementData(localPlayer, "ogrodnik:zakonczono", false)

function tworzenieMarkera()
    rnd = math.random(1, #punktyOgrodnik)
    markerRandomowy = createMarker(punktyOgrodnik[rnd][1], punktyOgrodnik[rnd][2], punktyOgrodnik[rnd][3], 'cylinder', 1.5)
    blipRandomowy = createBlipAttachedTo(markerRandomowy, 41)
end

        function onRandom(h)
        if h ~= localPlayer then return end
        if isPedInVehicle(localPlayer) then return end
            target = target+1
            setElementData(localPlayer, "ogrodnik:zakonczono", false)
            addEventHandler("onClientRender", root, function()
                if getElementData(localPlayer, "ogrodnik:zakonczono") then return end
                dxDrawImage(241*px, 63*py, 570*px, 357*py,"trawa.png")
                dxDrawImage(mousePoints[target][1], mousePoints[target][2], mousePoints[target][3], mousePoints[target][4],"kolo.png")
            end)
            showCursor(true)
            destroyElement(source)
            destroyElement(blipRandomowy)
        end

function gui()
    if not getElementData(localPlayer, "praca:ogrodnik:gui") == true then return end
    dxDrawImage(312*px, 184*py, 400*px, 400*py, "test.png")
end
addEventHandler("onClientRender", root, gui)

bindKey("mouse1", "down", function()
    if not getElementData(localPlayer, "praca:ogrodnik:gui") == true then return end
    if isMouseIn(538*px, 527*py, 161*px, 39*py) then
        setElementData(localPlayer, "praca:ogrodnik:gui", false)
        showCursor(false)
    end
    if isMouseIn(324*px, 527*py, 161*px, 39*py) then
    if isPedInVehicle(localPlayer) then return end
    if getElementData(localPlayer, "praca") then triggerEvent("onClientAddNotification", localPlayer, "Posiadasz aktywn? prac?", "error") return end
        triggerEvent("onClientAddNotification", localPlayer, "Rozpoczynasz prac? ogrodnika", "success")
        outputChatBox("Rozpoczynasz prac? ogrodnika. Aby zako?czy? wpisz /zakoncz.ogrodnik", 100, 100, 250)
        setElementData(localPlayer, "praca", "ogrodnik")
        setElementData(localPlayer, "praca:ogrodnik:gui", false)
        showCursor(false)
        tworzenieMarkera()
        addEventHandler("onClientMarkerHit", markerRandomowy, onRandom)
    end
end)

function kliki()
    if getElementData(localPlayer, "praca") ~= "ogrodnik" then return end
    if isMouseIn(mousePoints[target][1], mousePoints[target][2], mousePoints[target][3], mousePoints[target][4]) then
        target = target+1
        if target == #mousePoints then
            if not getElementData(localPlayer, "player:premium") then
            triggerServerEvent("hajsOgrodnik", localPlayer, math.random(20,50), math.random(0,2))
            else
            triggerServerEvent("hajsOgrodnik", localPlayer, math.random(20*1.2, 50*1.2), math.random(1,4))
            end
            target = 0
            setElementData(localPlayer, "ogrodnik:zakonczono", true)
            showCursor(false)
            tworzenieMarkera()
            addEventHandler("onClientMarkerHit", markerRandomowy, onRandom)
        end
        return
    end
end
bindKey("mouse1", "down", kliki)

addCommandHandler("zakoncz.ogrodnik", function()
    if getElementData(localPlayer, "praca") ~= "ogrodnik" then
        triggerEvent("onClientAddNotification", localPlayer, "Nie posiadasz aktywnej pracy ogrodnika", "error")
        return
    end
    setElementData(localPlayer, "praca", nil)
    destroyElement(markerRandomowy)
    destroyElement(blipRandomowy)
    triggerEvent("onClientAddNotification", localPlayer, "Ko?czysz prac? jako ogrodnik", "success")
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-21, 22:34


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

pokazac rosline czyli co? ze na mapie czy na radarze? jezeli na mapie to tutaj

    markerRandomowy = createMarker(punktyOgrodnik[rnd][1], punktyOgrodnik[rnd][2], punktyOgrodnik[rnd][3], 'cylinder', 1.5)

zmien alphe na 0 czyli

    markerRandomowy = createMarker(punktyOgrodnik[rnd][1], punktyOgrodnik[rnd][2], punktyOgrodnik[rnd][3], 'cylinder', 1.5,255,255,255,0)

i po tym zrob createElement z kwatkiem czy czyms tam z tymi samymi kordami co dales do markera

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: ogrodnik
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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