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

Wysłany: 2022-02-10, 19:58


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3987 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60

Witam.
Robi? prawo jazdy i chcia?bym ustawi? tras? kt?ra b?dzie inna dla ka?dej kategorii..
Niestety nie wychodzi mi.
Mo?e kto? wskaza? co robie ?le?




local PUNKTB =[kordy]
local PUNKTC =[kordy]
local PUNKTA =[kordyitp..
 
function startPJA()
    punkty_a 0
    destroyMarkersS()
    local x,y,punkty[punkt][1],punkty[punkt][2],punkty[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"A"500)
    kurs "A"
end

function startPJB()
    punkty_b 0
    destroyMarkersS()
    local x,y,punkty[punkt][1],punkty[punkt][2],punkty[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"B")
    kurs "B"
end

function startPJC()
    punkty_c 0
    destroyMarkersS()
    local x,y,punkty[punkt][1],punkty[punkt][2],punkty[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"C"750)
    kurs "C"
end

function endKurs()
    if kurs == "A" then
        setElementData(localPlayer"user:pjA"1)
        exports.rpg_noti:createNotification("x","Zda?‚e?› kurs na prawo jazdy kat. A")
    elseif kurs == "B" then
        setElementData(localPlayer"user:pjB"1)
        exports.rpg_noti:createNotification("x","Zda?‚e?› kurs na prawo jazdy kat. B")
    elseif kurs == "C" then
        setElementData(localPlayer"user:pjC"1)
        exports.rpg_noti:createNotification("x","Zda?‚e?› kurs na prawo jazdy kat. C")
    end
    triggerServerEvent("kurs:prawko"localPlayer)
end

local km 0

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker then return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    destroyElement(marker)
    marker false
    destroyElement(blip)
    blip false
    if punkt == #punkty then
        if kurs == "A" then
            addEventHandler("onClientRender"rootgui_km)
            km 2
        elseif kurs == "B" then
            addEventHandler("onClientRender"rootgui_km)
            km 2
        elseif kurs == "C" then
            addEventHandler("onClientRender"rootgui_km)
            km 2
        end
        return
    end
    punkt punkt+1
    local x,y,punkty[punkt][1],punkty[punkt][2],punkty[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
end)

function gui_km()
    local veh getPedOccupiedVehicle(localPlayer)
    local h getVehicleHandling(veh)
    local sx,sy,sz getElementVelocity(veh)
    local speed math.floor(math.ceil(((sx^2+sy^2+sz^2)^(0.5))*180))
    if speed 25 then
        km km-0.01
    end
    if km <= 0 then
        removeEventHandler("onClientRender"rootgui_km)
        endKurs()
    end
    exports["buttons"]:createCustomWindow(truescreenW 0.4234screenH 0.0250screenW 0.1531screenH 0.0750tocolor(255255255255), false)
    exports["buttons"]:createCustomText("Pozosta?&#8218;o do przejechania: "..string.format("%.1f"km).."km"screenW 0.4234screenH 0.0250screenW 0.1531+screenW 0.4234screenH 0.0750+screenH 0.0250tocolor(255255255), 0)
end

addEventHandler("onClientClick"root, function(b,s)
    if ~= "state" and ~= "down" then return end
    if isMouseIn(screenW 0.511screenH 0.68screenW 0.102screenH 0.044) and showed == true then
        guiSetVisible(gridlistfalse)
        showCursor(false)
        showed false
        removeEventHandler("onClientRender"rootgui)
    elseif isMouseIn(screenW 0.386screenH 0.68screenW 0.102screenH 0.044) and showed == true and not isMarkersS() then
        local selected guiGridListGetSelectedItem(gridlist)
        if selected 0 then return end
        local id guiGridListGetItemText(gridlistselected1falsefalse)
        id tonumber(id)
        local kasa getPlayerMoney(localPlayer)
        kasa tonumber(kasa)
        local cena id == and 500 or id == and or id == and 750
        if kasa >= cena then
            prawko id == and "A" or id == and "B" or id == and "C"
            if prawko == "A" and getElementData(localPlayer"user:pjA") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii A.")
                return
            elseif prawko == "B" and getElementData(localPlayer"user:pjB") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii B.")
                return
            elseif prawko == "C" and getElementData(localPlayer"user:pjC") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii C.")
                return
            end
            createMarkersS()
            exports["rpg_noti"]:createNotification("info""Udaj si?&#8482; do niebieskiego markera.")
            guiSetVisible(gridlistfalse)
            showCursor(false)
            showed false
            removeEventHandler("onClientRender"rootgui)
        else
            exports["rpg_noti"]:createNotification("info""Brak wystarczaj?&#8230;cych funduszy.")
        end
    elseif isMouseIn(screenW 0.511screenH 0.68screenW 0.102screenH 0.044) and showed_teoria == true then
        showCursor(false)
        showed_teoria false
        removeEventHandler("onClientRender"rootgui_teoria_a)
        removeEventHandler("onClientRender"rootgui_teoria_b)
        removeEventHandler("onClientRender"rootgui_teoria_c)
        guiSetVisible(takfalse)
        guiSetVisible(niefalse)
        pytanie_a 1
        punkty_a 0
        pytanie_b 1
        punkty_b 0
        pytanie_c 1
        punkty_c 0
        setPedAnimation(localPlayer"CARRY""liftup"0.0falsefalsefalsefalse )
    end
end)

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if not source or source and not isElement(sourcethen return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    local data getElementData(source"stanowisko:prawko")
    local data2 getElementData(source"stanowisko:position")
    if data and data2 then
        local x,y,z,rz data2[1],data2[2],data2[3],data2[4]
        setElementPosition(hitxyz)
        setElementRotation(hit00rz)
        setPedAnimation(hit"INT_OFFICE""OFF_Sit_Idle_Loop", -1truefalse)
        guiSetVisible(taktrue)
        guiSetVisible(nietrue)
        if prawko == "A" then
            showed_teoria true
            addEventHandler("onClientRender"rootgui_teoria_a)
            prawko "A"
            showCursor(true)
        elseif prawko == "B" then
            showed_teoria true
            showCursor(true)
            addEventHandler("onClientRender"rootgui_teoria_b)
            prawko "B"
        elseif prawko == "C" then
            showed_teoria true
            showCursor(true)
            addEventHandler("onClientRender"rootgui_teoria_c)
            prawko "C"
        end
    end
end)



stawiam zimne piwo!

[ Dodano: 2022-02-10, 19:59 ]
@EDIT
Oczywi?cie daje punkt wyj?cia z jakiego zaczyna?em... ?eby po prostu z jednej trasy zrobi? 3.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-10, 20:18


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4044 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

Przyk?ad:
local punkty = {
         {0,0,0},
         {0,0,0},
}

function startPJKATEGORIA()
    local x,y,punkty[punkt][1],punkty[punkt][2],punkty[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Norbert1234
Wysłany: 2022-02-10, 21:38


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3987 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60

Da?em rade sam. Ale gdy wjad? w punkt 1 z prawka C to kolejny si? pojawia jako punkt ustawiony do A i w B tak samo

[ Dodano: 2022-02-10, 21:50 ]

local PB = {

{-1514.45593261722615.562744140655.831321716309}, -- pocz?tek
{-1526.46997070312615.842041015655.8359375},
{-1531.8574218752620.255615234455.8359375},
{-1531.88818359382629.640136718855.8359375},
{-1531.91479492192622.615722656255.8359375},
{-1530.42028808592616.445556640655.81213760376},
{-1520.30261230472615.569335937555.8359375},
{-1508.35217285162616.305419921955.780403137207},
{-1520.67346191412655.006347656255.8359375},
{-1533.13562011722673.86914062555.6875}, -- koniec
}

local PA = {
{-1510.75500488282620.852294921955.8359375},
{-1513.86315917972631.529541015655.8359375},
{-1515.76452636722645.88476562555.8359375},
{-1514.37927246092655.522949218855.8359375},
{-1532.08020019532655.974853515655.8359375},
{-1528.02380371092646.640869140655.8359375},
{-1520.34362792972655.815185546955.8359375},
{-1511.05944824222668.689697265655.6875},
}

local PC = (
{-1520.34631347662647.528076171955.8359375},
{-1520.96838378912658.841308593855.8359375},
{-1510.66503906252668.767822265655.8359375}, -- koniec
)





function startPJA()
    punkty_a 0
    destroyMarkersS()
    local x,y,PA[punkt][1],PA[punkt][2],PA[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"A"500)
    kurs "A"
end

function startPJB()
    punkty_b 0
    destroyMarkersS()
    local x,y,PB[punkt][1],PB[punkt][2],PB[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"B")
    kurs "B"
end

function startPJC()
    punkty_c 0
    destroyMarkersS()
    local x,y,PC[punkt][1],PC[punkt][2],PC[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
    triggerServerEvent("kurs:prawko"localPlayer"C"750)
    kurs "C"
end

function endKurs()
    if kurs == "A" then
        setElementData(localPlayer"user:pjA"1)
        exports.rpg_noti:createNotification("x","Zda?&#8218;e?&#8250; kurs na prawo jazdy kat. A")
    elseif kurs == "B" then
        setElementData(localPlayer"user:pjB"1)
        exports.rpg_noti:createNotification("x","Zda?&#8218;e?&#8250; kurs na prawo jazdy kat. B")
    elseif kurs == "C" then
        setElementData(localPlayer"user:pjC"1)
        exports.rpg_noti:createNotification("x","Zda?&#8218;e?&#8250; kurs na prawo jazdy kat. C")
    end
    triggerServerEvent("kurs:prawko"localPlayer)
end

local km 0

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker then return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    destroyElement(marker)
    marker false
    destroyElement(blip)
    blip false
    if punkt == #PA then
        if kurs == "A" then
            addEventHandler("onClientRender"rootgui_km)
            km 60
        end
        return
    end
    punkt punkt+1
    local x,y,PA[punkt][1],PA[punkt][2],PA[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
end)

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker then return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    destroyElement(marker)
    marker false
    destroyElement(blip)
    blip false
    if punkt == #PB then

        if kurs == "B" then
            addEventHandler("onClientRender"rootgui_km)
            km 2
        end
        return
    end
    punkt punkt+1
    local x,y,PB[punkt][1],PB[punkt][2],PB[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
end)

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if source ~= marker then return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    destroyElement(marker)
    marker false
    destroyElement(blip)
    blip false
    if punkt == #PC then
        if kurs == "C" then
            addEventHandler("onClientRender"rootgui_km)
            km 2
        end
        return
    end
    punkt punkt+1
    local x,y,PC[punkt][1],PC[punkt][2],PC[punkt][3]
    marker createMarker(x,y,z-0.7,"cylinder",3,0,255,0,75)
    blip createBlipAttachedTo(marker41)
end)

function gui_km()
    local veh getPedOccupiedVehicle(localPlayer)
    local h getVehicleHandling(veh)
    local sx,sy,sz getElementVelocity(veh)
    local speed math.floor(math.ceil(((sx^2+sy^2+sz^2)^(0.5))*180))
    if speed 25 then
        km km-0.01
    end
    if km <= 0 then
        removeEventHandler("onClientRender"rootgui_km)
        endKurs()
    end
    exports["buttons"]:createCustomWindow(truescreenW 0.4234screenH 0.0250screenW 0.1531screenH 0.0750tocolor(255255255255), false)
    exports["buttons"]:createCustomText("Pozosta?&#8218;o do przejechania: "..string.format("%.1f"km).."km"screenW 0.4234screenH 0.0250screenW 0.1531+screenW 0.4234screenH 0.0750+screenH 0.0250tocolor(255255255), 0)
end

addEventHandler("onClientClick"root, function(b,s)
    if ~= "state" and ~= "down" then return end
    if isMouseIn(screenW 0.511screenH 0.68screenW 0.102screenH 0.044) and showed == true then
        guiSetVisible(gridlistfalse)
        showCursor(false)
        showed false
        removeEventHandler("onClientRender"rootgui)
    elseif isMouseIn(screenW 0.386screenH 0.68screenW 0.102screenH 0.044) and showed == true and not isMarkersS() then
        local selected guiGridListGetSelectedItem(gridlist)
        if selected 0 then return end
        local id guiGridListGetItemText(gridlistselected1falsefalse)
        id tonumber(id)
        local kasa getPlayerMoney(localPlayer)
        kasa tonumber(kasa)
        local cena id == and 500 or id == and or id == and 750
        if kasa >= cena then
            prawko id == and "A" or id == and "B" or id == and "C"
            if prawko == "A" and getElementData(localPlayer"user:pjA") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii A.")
                return
            elseif prawko == "B" and getElementData(localPlayer"user:pjB") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii B.")
                return
            elseif prawko == "C" and getElementData(localPlayer"user:pjC") == 1 then
                exports["rpg_noti"]:createNotification("info""Posiadasz juĹĽ prawo jazdy kategorii C.")
                return
            end
            createMarkersS()
            exports["rpg_noti"]:createNotification("info""Udaj si?&#8482; do niebieskiego markera.")
            guiSetVisible(gridlistfalse)
            showCursor(false)
            showed false
            removeEventHandler("onClientRender"rootgui)
        else
            exports["rpg_noti"]:createNotification("info""Brak wystarczaj?&#8230;cych funduszy.")
        end
    elseif isMouseIn(screenW 0.511screenH 0.68screenW 0.102screenH 0.044) and showed_teoria == true then
        showCursor(false)
        showed_teoria false
        removeEventHandler("onClientRender"rootgui_teoria_a)
        removeEventHandler("onClientRender"rootgui_teoria_b)
        removeEventHandler("onClientRender"rootgui_teoria_c)
        guiSetVisible(takfalse)
        guiSetVisible(niefalse)
        pytanie_a 1
        punkty_a 0
        pytanie_b 1
        punkty_b 0
        pytanie_c 1
        punkty_c 0
        setPedAnimation(localPlayer"CARRY""liftup"0.0falsefalsefalsefalse )
    end
end)

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
    if hit ~= localPlayer then return end
    if not source or source and not isElement(sourcethen return end
    if getElementDimension(source) ~= getElementDimension(hitthen return end
    if getElementInterior(source) ~= getElementInterior(hitthen return end
    local data getElementData(source"stanowisko:prawko")
    local data2 getElementData(source"stanowisko:position")
    if data and data2 then
        local x,y,z,rz data2[1],data2[2],data2[3],data2[4]
        setElementPosition(hitxyz)
        setElementRotation(hit00rz)
        setPedAnimation(hit"INT_OFFICE""OFF_Sit_Idle_Loop", -1truefalse)
        guiSetVisible(taktrue)
        guiSetVisible(nietrue)
        if prawko == "A" then
            showed_teoria true
            addEventHandler("onClientRender"rootgui_teoria_a)
            prawko "A"
            showCursor(true)
        elseif prawko == "B" then
            showed_teoria true
            showCursor(true)
            addEventHandler("onClientRender"rootgui_teoria_b)
            prawko "B"
        elseif prawko == "C" then
            showed_teoria true
            showCursor(true)
            addEventHandler("onClientRender"rootgui_teoria_c)
            prawko "C"
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Tagi: ustawienie :: trasy :: losowej.
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