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

Wysłany: 2019-11-19, 01:06


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Cze??,
Pr?buj? si? dalej uczy? lua, ale oczywi?cie jeszcze nie pojmuje jakie funkcje bra? i gdzie, no chyba ?e kojarze jakie? rzeczy, daltego narazie postanowi?em tworzy? jakie? ma?e skrypty z pomoc? linijek z innych skrypt?w, ale zrobi? tak aby to dzia?a?o i ?adnie wygl?da?o.

Borykam si? z problemem, ?e gdy rozpoczniemy prac?, daje nam randomowy marker, i po wej?ciu w ten marker powinna by? animacja "?cinania czego?" oraz po zako?czeniu animacji dostawania kasy, lecz po wej?ciu w marker nic si? nie dzieje, dlaczego?


--[[
   Skrypt: Praca zbieracza Marihuany.
   Autor Skryptu: Rynberto
   Nie masz prawa u?ycia kodu skryptu bez mojej zgody.
   Skrypt utworzony 09.11.2019
]]

createBlip(1102.35, -1189.51, 18.32, 46,2,0,0,0,0,0,275) -- Blip Pracy

local markerPraca = createMarker(1102.35, -1189.51, 17.32, "cylinder", 2.0, 133, 133, 133, 50) -- Marker rozpocz?cia pracy

local punktyMarycha = {
    {1106.44, -1218.19, 18.24},
    {1100.63, -1217.34, 18.24},
    {1095.28, -1216.79, 18.24},
}

function MarkerHit ( hitPlayer, matchingDimension ) 
 setElementData(localPlayer, "praca:hodowca", true)
 showCursor(true)
 setElementFrozen ( localPlayer, true)
 vehicle = getPedOccupiedVehicle ( hitPlayer ) -- Je?li gracz b?dzie chcia? wej?? w marker i pracowa? w aucie, to nie b?dzie m?g? tego zrobi?
    if hitPlayer ~= localPlayer then return end
        if source == markerPraca then
            HandleTheRendering() -- pokazuje obrazek
        end
end
addEventHandler("onClientMarkerHit", markerPraca, MarkerHit)


function isMouseIn ( x, y, width, height ) -- FunkcjaKlikuMysz?
    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

function tworzenieMarkera() -- Funkcja randomowych punkt?wMarychy
    rnd = math.random(1, #punktyMarycha)
    markerRandomowy = createMarker(punktyMarycha[rnd][1], punktyMarycha[rnd][2], punktyMarycha[rnd][3], 'cylinder', 1.5)
    blipRandomowy = createBlipAttachedTo(markerRandomowy, 41)
end


bindKey("mouse1", "down", function() -- Bind pod menu obrazka
    if not getElementData(localPlayer, "praca:hodowca") == true then return end
        if isMouseIn(734, 507, 165, 39) then -- Przycisk Anuluj
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze anuluj
        setElementData(localPlayer, "praca:hodowca", false)
        showCursor(false)
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
    end
    if isMouseIn(734, 447, 165, 39) then -- Przycisk Rozpocznij
    if isPedInVehicle(localPlayer) then return end
    if getElementData(localPlayer, "praca") then outputChatBox("Aktualnie ju? pracujesz!", 255, 0, 0) return end
        outputChatBox("Rozpoczynasz prac? Hodowcy.", 100, 100, 250)
        setElementData(localPlayer, "praca", "hodowca") -- Ustawia elementDate pracy
    toggleControl("sprint", false ) -- Wy??czenie sprintu podczas pracy
    toggleControl("jump", false ) -- Wy??czenie skakania podczas pracy
    toggleControl("crouch", false ) -- Wy??czenie skradania si? podczas pracy
        local skrzynia = createObject(335, 0, 0, 0)
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze Rozpocznij
        setElementData(localPlayer, "praca:hodowca", false) -- Usuniecie ElementDaty pracy
        showCursor(false)
        tworzenieMarkera()
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
        addEventHandler("onClientMarkerHit", markerRandomowy)

    end
end)

addEventHandler("onClientMarkerHit", markerRandomowy, function(el, md)    
            if not md or getElementType(el) ~= "player" then return end
            if el ~= localPlayer then return end

            if getPedOccupiedVehicle(el) then
            --triggerClientEvent(localPlayer, "CreateBox", getRootElement(), "error", "Nie mo?esz pracowa? b?d?c w poje?dzie...")
            triggerServerEvent ("car", localPlayer)
                return
            end

            destroyElement(blipRandomowy)
            setElementFrozen(el, true)
            triggerServerEvent ("start2", localPlayer)
            triggerServerEvent ("animka", localPlayer)
            setTimer(function()
                setElementFrozen(el, false)
                destroyElement(cel)
                destroyElement(skrzynia)
                --triggerServerEvent ("zb", localPlayer)
                triggerServerEvent ("zanimka", localPlayer)
                setElementData(localPlayer, "praca:hodowca", false)
                local zarobek = math.random(8000,10000)
                    outputChatBox("?ci??e? do woreczka maryche otrzymujesz "..zarobek.." PLN!", 255, 255, 255)
                triggerServerEvent("givePlayerMoney", localPlayer, zarobek)
                toggleControl("sprint", true )
                toggleControl("jump", true )
                toggleControl("crouch", true )
            end, 5000, 1)
        end)


local screenWidth,screenHeight = guiGetScreenSize() 


function obrazek ( )
    -- ScreenWidth, ScreenHeight, Pixel X, Pixel Y
    dxDrawImage ( screenWidth/2 - 650, screenHeight/2 + -380, 1300, 800, 'Obrazki/Hodowca.png' )
end

function stopobrazek ( )
    removeEventHandler("onClientRender", root, obrazek)
end

function HandleTheRendering ( )
    addEventHandler("onClientRender", root, obrazek) 
end

fileDelete("Hodowca_c.lua")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 09:26


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Na samym pocz?tku pliku dodaj
Kod:

local markerRandomowy


W tym evencie od randomowego markera raz u?ywasz el a raz localPlayer. ?e wzgl?d?w estetycznych m?g?by? to poprawi?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 09:38


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Nadal po wej?ciu w marker losowego punktu nic si? nie dzieje, b??d w DB3:




--[[
   Skrypt: Praca zbieracza Marihuany.
   Autor Skryptu: Rynberto
   Nie masz prawa u?ycia kodu skryptu bez mojej zgody.
   Skrypt utworzony 09.11.2019
]]

local markerRandomowy

createBlip(1102.35, -1189.51, 18.32, 46,2,0,0,0,0,0,275) -- Blip Pracy

local markerPraca = createMarker(1102.35, -1189.51, 17.32, "cylinder", 2.0, 133, 133, 133, 50) -- Marker rozpocz?cia pracy

local punktyMarycha = {
    {1106.44, -1218.19, 18.24},
    {1100.63, -1217.34, 18.24},
    {1095.28, -1216.79, 18.24},
}

function MarkerHit ( hitPlayer, matchingDimension ) 
 setElementData(localPlayer, "praca:hodowca", true)
 showCursor(true)
 setElementFrozen ( localPlayer, true)
 vehicle = getPedOccupiedVehicle ( hitPlayer ) -- Je?li gracz b?dzie chcia? wej?? w marker i pracowa? w aucie, to nie b?dzie m?g? tego zrobi?
    if hitPlayer ~= localPlayer then return end
        if source == markerPraca then
            HandleTheRendering() -- pokazuje obrazek
        end
end
addEventHandler("onClientMarkerHit", markerPraca, MarkerHit)


function isMouseIn ( x, y, width, height ) -- FunkcjaKlikuMysz?
    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

function tworzenieMarkera() -- Funkcja randomowych punkt?wMarychy
    rnd = math.random(1, #punktyMarycha)
    markerRandomowy = createMarker(punktyMarycha[rnd][1], punktyMarycha[rnd][2], punktyMarycha[rnd][3], 'cylinder', 1.5)
    blipRandomowy = createBlipAttachedTo(markerRandomowy, 41)
end


bindKey("mouse1", "down", function() -- Bind pod menu obrazka
    if not getElementData(localPlayer, "praca:hodowca") == true then return end
        if isMouseIn(734, 507, 165, 39) then -- Przycisk Anuluj
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze anuluj
        setElementData(localPlayer, "praca:hodowca", false)
        showCursor(false)
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
    end
    if isMouseIn(734, 447, 165, 39) then -- Przycisk Rozpocznij
    if isPedInVehicle(localPlayer) then return end
    if getElementData(localPlayer, "praca") then outputChatBox("Aktualnie ju? pracujesz!", 255, 0, 0) return end
        outputChatBox("Rozpoczynasz prac? Hodowcy.", 100, 100, 250)
        setElementData(localPlayer, "praca", "hodowca") -- Ustawia elementDate pracy
    toggleControl("sprint", false ) -- Wy??czenie sprintu podczas pracy
    toggleControl("jump", false ) -- Wy??czenie skakania podczas pracy
    toggleControl("crouch", false ) -- Wy??czenie skradania si? podczas pracy
        local skrzynia = createObject(335, 0, 0, 0)
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze Rozpocznij
        setElementData(localPlayer, "praca:hodowca", false) -- Usuniecie ElementDaty pracy
        showCursor(false)
        tworzenieMarkera()
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
        addEventHandler("onClientMarkerHit", markerRandomowy)

    end
end)

addEventHandler("onClientMarkerHit", markerRandomowy, function(el, md)    
            if not md or getElementType(el) ~= "player" then return end
            if el ~= localPlayer then return end

            if getPedOccupiedVehicle(el) then
            --triggerClientEvent(localPlayer, "CreateBox", getRootElement(), "error", "Nie mo?esz pracowa? b?d?c w poje?dzie...")
            triggerServerEvent ("car", localPlayer)
                return
            end

            destroyElement(blipRandomowy)
            setElementFrozen(el, true)
            triggerServerEvent ("start2", localPlayer)
            triggerServerEvent ("animka", localPlayer)
            setTimer(function()
                setElementFrozen(el, false)
                destroyElement(cel)
                destroyElement(skrzynia)
                --triggerServerEvent ("zb", localPlayer)
                triggerServerEvent ("zanimka", localPlayer)
                setElementData(localPlayer, "praca:hodowca", false)
                local zarobek = math.random(8000,10000)
                    outputChatBox("?ci??e? do woreczka maryche otrzymujesz "..zarobek.." PLN!", 255, 255, 255)
                triggerServerEvent("givePlayerMoney", localPlayer, zarobek)
                toggleControl("sprint", true )
                toggleControl("jump", true )
                toggleControl("crouch", true )
            end, 5000, 1)
        end)


local screenWidth,screenHeight = guiGetScreenSize()  -- Ro?dzielczo??


function obrazek ( )
    -- ScreenWidth, ScreenHeight, Pixel X, Pixel Y
    dxDrawImage ( screenWidth/2 - 650, screenHeight/2 + -380, 1300, 800, 'Obrazki/Hodowca.png' ) -- Dodaje obrazek
end

function stopobrazek ( )
    removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
end

function HandleTheRendering ( )
    addEventHandler("onClientRender", root, obrazek)  -- Dzi?ki temu jest wy?wietlany obrazek
end

fileDelete("Hodowca_c.lua")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 09:50


Mikołajj







Wiek: 23
Na forum: 3026 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

Zobacz tak:

function MarkerHit ( hitPlayer, matchingDimension ) 
    if el ~= localPlayer or not md then return end
    setElementData(localPlayer, "praca:hodowca", true)
    showCursor(true)
    setElementFrozen ( localPlayer, true)
    vehicle = getPedOccupiedVehicle ( hitPlayer ) -- Je?li gracz b?dzie chcia? wej?? w marker i pracowa? w aucie, to nie b?dzie m?g? tego zrobi?
       if hitPlayer ~= localPlayer then return end
           if source == markerPraca then
               HandleTheRendering() -- pokazuje obrazek
           end
   end
   addEventHandler("onClientMarkerHit", markerPraca, MarkerHit)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 10:02


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Teraz wgl si? nie wy?wietla nic nawet jak wejd? w marker rozpocz?cia pracy :-?
Przywr?ci?em do kodu wy?ej

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 14:05


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Usun to co dodales co ten go?ciu tutaj wys?a?. Doda? jedna linijke bez jakiegokolwiek my?lenia.
To: "??if?el?~=?localPlayer?or?not?md?then?return?end"

Ca?y ten event przenie? do funkcji tworzenieMarkera() i usun to co prosi?em ?eby? doda? (local na pocz?tku).

ST4GE, jakby? troch? my?la? to zauwazylbys brak zmiennej el. To samo jest ju? w kodzie ale ni?ej. Rozumiem jakby? to przeni?s? ale dodales drugi raz prawie to samo XD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 16:37


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Zrobi?em, teraz nie pokazuje si? nic bo s? jakie? b??dy(marker rozpocz?cia pracy i wszystko znik?o)


--[[
   Skrypt: Praca zbieracza Marihuany.
   Autor Skryptu: Rynberto
   Nie masz prawa u?ycia kodu skryptu bez mojej zgody.
   Skrypt utworzony 09.11.2019
]]

local markerRandomowy

createBlip(1102.35, -1189.51, 18.32, 46,2,0,0,0,0,0,275) -- Blip Pracy

local markerPraca = createMarker(1102.35, -1189.51, 17.32, "cylinder", 2.0, 133, 133, 133, 50) -- Marker rozpocz?cia pracy

local punktyMarycha = {
    {1106.44, -1218.19, 18.24},
    {1100.63, -1217.34, 18.24},
    {1095.28, -1216.79, 18.24},
}

function MarkerHit ( hitPlayer, matchingDimension ) 
 setElementData(localPlayer, "praca:hodowca", true)
 showCursor(true)
 setElementFrozen ( localPlayer, true)
 vehicle = getPedOccupiedVehicle ( hitPlayer ) -- Je?li gracz b?dzie chcia? wej?? w marker i pracowa? w aucie, to nie b?dzie m?g? tego zrobi?
    if hitPlayer ~= localPlayer then return end
        if source == markerPraca then
            HandleTheRendering() -- pokazuje obrazek
        end
end
addEventHandler("onClientMarkerHit", markerPraca, MarkerHit)


function isMouseIn ( x, y, width, height ) -- FunkcjaKlikuMysz?
    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

function tworzenieMarkera() -- Funkcja randomowych punkt?wMarychy
    rnd = math.random(1, #punktyMarycha)
    markerRandomowy = createMarker(punktyMarycha[rnd][1], punktyMarycha[rnd][2], punktyMarycha[rnd][3], 'cylinder', 1.5)
    blipRandomowy = createBlipAttachedTo(markerRandomowy, 41)
    addEventHandler("onClientMarkerHit", markerRandomowy, function(el, md)    
            if not md or getElementType(el) ~= "player" then return end
            if el ~= localPlayer then return end

            if getPedOccupiedVehicle(el) then
            --triggerClientEvent(localPlayer, "CreateBox", getRootElement(), "error", "Nie mo?esz pracowa? b?d?c w poje?dzie...")
            triggerServerEvent ("car", localPlayer)
                return
            end

            destroyElement(blipRandomowy)
            setElementFrozen(el, true)
            triggerServerEvent ("start2", localPlayer)
            triggerServerEvent ("animka", localPlayer)
            setTimer(function()
                setElementFrozen(el, false)
                destroyElement(cel)
                destroyElement(skrzynia)
                --triggerServerEvent ("zb", localPlayer)
                triggerServerEvent ("zanimka", localPlayer)
                setElementData(localPlayer, "praca:hodowca", false)
                local zarobek = math.random(8000,10000)
                    outputChatBox("?ci??e? do woreczka maryche otrzymujesz "..zarobek.." PLN!", 255, 255, 255)
                triggerServerEvent("givePlayerMoney", localPlayer, zarobek)
                toggleControl("sprint", true )
                toggleControl("jump", true )
                toggleControl("crouch", true )
            end, 5000, 1)
end


bindKey("mouse1", "down", function() -- Bind pod menu obrazka
    if not getElementData(localPlayer, "praca:hodowca") == true then return end
        if isMouseIn(734, 507, 165, 39) then -- Przycisk Anuluj
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze anuluj
        setElementData(localPlayer, "praca:hodowca", false)
        showCursor(false)
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
    end
    if isMouseIn(734, 447, 165, 39) then -- Przycisk Rozpocznij
    if isPedInVehicle(localPlayer) then return end
    if getElementData(localPlayer, "praca") then outputChatBox("Aktualnie ju? pracujesz!", 255, 0, 0) return end
        outputChatBox("Rozpoczynasz prac? Hodowcy.", 100, 100, 250)
        setElementData(localPlayer, "praca", "hodowca") -- Ustawia elementDate pracy
    toggleControl("sprint", false ) -- Wy??czenie sprintu podczas pracy
    toggleControl("jump", false ) -- Wy??czenie skakania podczas pracy
    toggleControl("crouch", false ) -- Wy??czenie skradania si? podczas pracy
        local skrzynia = createObject(335, 0, 0, 0)
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze Rozpocznij
        setElementData(localPlayer, "praca:hodowca", false) -- Usuniecie ElementDaty pracy
        showCursor(false)
        tworzenieMarkera()
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
        addEventHandler("onClientMarkerHit", markerRandomowy)

    end
end)


local screenWidth,screenHeight = guiGetScreenSize()  -- Ro?dzielczo??


function obrazek ( )
    -- ScreenWidth, ScreenHeight, Pixel X, Pixel Y
    dxDrawImage ( screenWidth/2 - 650, screenHeight/2 + -380, 1300, 800, 'Obrazki/Hodowca.png' ) -- Dodaje obrazek
end

function stopobrazek ( )
    removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
end

function HandleTheRendering ( )
    addEventHandler("onClientRender", root, obrazek)  -- Dzi?ki temu jest wy?wietlany obrazek
end

fileDelete("Hodowca_c.lua")




Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 16:46


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie zamykasz eventu, kt?ry przenios?es. Znowu w bindKey jest o jednego enda za duzo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 17:14


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Usun??em endy spod eventhandleru kt?ry przenios??m, potem usuwa?em po kolei endy w bindkeyu tak jak pisa?e? aby zobaczy? czy b?dzie dzia?a?, ale usuwa?em po kolei i w zadnym po usunieciu nie dzia?a?o.




--[[
   Skrypt: Praca zbieracza Marihuany.
   Autor Skryptu: Rynberto
   Nie masz prawa u?ycia kodu skryptu bez mojej zgody.
   Skrypt utworzony 09.11.2019
]]

local markerRandomowy

createBlip(1102.35, -1189.51, 18.32, 46,2,0,0,0,0,0,275) -- Blip Pracy

local markerPraca = createMarker(1102.35, -1189.51, 17.32, "cylinder", 2.0, 133, 133, 133, 50) -- Marker rozpocz?cia pracy

local punktyMarycha = {
    {1106.44, -1218.19, 18.24},
    {1100.63, -1217.34, 18.24},
    {1095.28, -1216.79, 18.24},
}

function MarkerHit ( hitPlayer, matchingDimension ) 
 setElementData(localPlayer, "praca:hodowca", true)
 showCursor(true)
 setElementFrozen ( localPlayer, true)
 vehicle = getPedOccupiedVehicle ( hitPlayer ) -- Je?li gracz b?dzie chcia? wej?? w marker i pracowa? w aucie, to nie b?dzie m?g? tego zrobi?
    if hitPlayer ~= localPlayer then return end
        if source == markerPraca then
            HandleTheRendering() -- pokazuje obrazek
        end
end
addEventHandler("onClientMarkerHit", markerPraca, MarkerHit)


function isMouseIn ( x, y, width, height ) -- FunkcjaKlikuMysz?
    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

function tworzenieMarkera() -- Funkcja randomowych punkt?wMarychy
    rnd = math.random(1, #punktyMarycha)
    markerRandomowy = createMarker(punktyMarycha[rnd][1], punktyMarycha[rnd][2], punktyMarycha[rnd][3], 'cylinder', 1.5)
    blipRandomowy = createBlipAttachedTo(markerRandomowy, 41)
    addEventHandler("onClientMarkerHit", markerRandomowy, function(el, md)    
            if not md or getElementType(el) ~= "player" then return end
            if el ~= localPlayer then return end

            if getPedOccupiedVehicle(el) then
            --triggerClientEvent(localPlayer, "CreateBox", getRootElement(), "error", "Nie mo?esz pracowa? b?d?c w poje?dzie...")
            triggerServerEvent ("car", localPlayer)
                return
            end

            destroyElement(blipRandomowy)
            setElementFrozen(el, true)
            triggerServerEvent ("start2", localPlayer)
            triggerServerEvent ("animka", localPlayer)
            setTimer(function()
                setElementFrozen(el, false)
                destroyElement(cel)
                destroyElement(skrzynia)
                --triggerServerEvent ("zb", localPlayer)
                triggerServerEvent ("zanimka", localPlayer)
                setElementData(localPlayer, "praca:hodowca", false)
                local zarobek = math.random(8000,10000)
                    outputChatBox("?ci??e? do woreczka maryche otrzymujesz "..zarobek.." PLN!", 255, 255, 255)
                triggerServerEvent("givePlayerMoney", localPlayer, zarobek)
                toggleControl("sprint", true )
                toggleControl("jump", true )
                toggleControl("crouch", true )
            end, 5000, 1)


bindKey("mouse1", "down", function() -- Bind pod menu obrazka
    if not getElementData(localPlayer, "praca:hodowca") == true then return end
        if isMouseIn(734, 507, 165, 39) then -- Przycisk Anuluj
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze anuluj
        setElementData(localPlayer, "praca:hodowca", false)
        showCursor(false)
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
    end
    if isMouseIn(734, 447, 165, 39) then -- Przycisk Rozpocznij
    if isPedInVehicle(localPlayer) then return end
    if getElementData(localPlayer, "praca") then outputChatBox("Aktualnie ju? pracujesz!", 255, 0, 0) return end
        outputChatBox("Rozpoczynasz prac? Hodowcy.", 100, 100, 250)
        setElementData(localPlayer, "praca", "hodowca") -- Ustawia elementDate pracy
    toggleControl("sprint", false ) -- Wy??czenie sprintu podczas pracy
    toggleControl("jump", false ) -- Wy??czenie skakania podczas pracy
    toggleControl("crouch", false ) -- Wy??czenie skradania si? podczas pracy
        local skrzynia = createObject(335, 0, 0, 0)
        setElementFrozen ( localPlayer, false) -- Odmro?enie gracza je?li wybierze Rozpocznij
        setElementData(localPlayer, "praca:hodowca", false) -- Usuniecie ElementDaty pracy
        showCursor(false)
        tworzenieMarkera()
        removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
        addEventHandler("onClientMarkerHit", markerRandomowy)

    end
end)


local screenWidth,screenHeight = guiGetScreenSize()  -- Ro?dzielczo??


function obrazek ( )
    -- ScreenWidth, ScreenHeight, Pixel X, Pixel Y
    dxDrawImage ( screenWidth/2 - 650, screenHeight/2 + -380, 1300, 800, 'Obrazki/Hodowca.png' ) -- Dodaje obrazek
end

function stopobrazek ( )
    removeEventHandler("onClientRender", root, obrazek) -- Usuwa obrazek
end

function HandleTheRendering ( )
    addEventHandler("onClientRender", root, obrazek)  -- Dzi?ki temu jest wy?wietlany obrazek
end

fileDelete("Hodowca_c.lua")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-11-19, 18:30


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Kozak, musisz doda? te endy bo ich brakowa?o.
Teraz nie tylko event si? nie zamyka ale ca?a funkcja, w kt?rej jest.
Je?li zamykasz event, w kt?rym od razu masz funkcj? u?ywasz nawiasu przy endzie.
Je?li jest to oddzielna funkcja to samo end, bez nawias?w.

Postaw piwo autorowi tego posta
 

 
Tagi: wejściu :: marker :: nic :: się :: nie :: dzieje
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