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

Wysłany: 2016-08-09, 15:02


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Witam mo?e kto? mi pom?c z tymi punktami chodzi mi o to ?eby je dostawa? za prace.
Praca:
local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)

Punkty:
addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score")
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do
        setElementData(thePlayer,"Punkt",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Punkt",0)
end)

function addScore(points)
    setElementData(source, "points", getElementData(source, "points") + points)
end

addEvent("addScore", true)
addEventHandler("addScore", getRootElement(), addScore)
---------dawanie score

addCommandHandler ( "dajpunkt",
function ( player, cmd, nick, kwota )


        if nick and kwota then
            local aplayer = getPlayerFromName ( nick )
            if aplayer then
                kwota = tonumber(kwota)
           
                    setElementData(aplayer,"Punkt",kwota)
                    --givePlayerMoney ( aplayer, kwota )
                    
             outputChatBox ( "Punkty dodane" )

else
      outputChatBox( "Nie jestes H@", getRootElement())   
    outputChatBox ( "Nieudana proba dodania Punkty." )

end 
end
end )

Za pomoc :piwo:

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-09, 17:06


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
        triggerServerEvent("punkty", localPlayer)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)


i daj strone servera pracy

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-09, 17:13


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

setElementData(aplayer,"Punkt",kwota) proponuje zmienic na :
setElementData(aplayer,"Punkt", getElementData(aplayer, "Punkt") + kwota)

kod:


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score")
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do
        setElementData(thePlayer,"Punkt",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Punkt",0)
end)

function addScore(points)
    setElementData(source, "points", getElementData(source, "points") + points)
end

addEvent("addScore", true)
addEventHandler("addScore", getRootElement(), addScore)
---------dawanie score

addCommandHandler ( "dajpunkt",
function ( player, cmd, nick, kwota )


        if nick and kwota then
            local aplayer = getPlayerFromName ( nick )
            if aplayer then
                kwota = tonumber(kwota)
           
                    setElementData(aplayer,"Punkt",kwota)
                    --givePlayerMoney ( aplayer, kwota )
                    
             outputChatBox ( "Punkty dodane" )

else
      outputChatBox( "Nie jestes H@", getRootElement())   
    outputChatBox ( "Nieudana proba dodania Punkty." )

end 
end
end )


zamie? na :


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score")
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do
        setElementData(thePlayer,"Punkt",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Punkt",0)
end)

function addScore(points)
    setElementData(source, "Punkt", getElementData(source, "Punkt") + points)
end

addEvent("addScore", true)
addEventHandler("addScore", getRootElement(), addScore)
---------dawanie score

addCommandHandler ( "dajpunkt",
function ( player, cmd, nick, kwota )


        if nick and kwota then
            local aplayer = getPlayerFromName ( nick )
            if aplayer then
                kwota = tonumber(kwota)
           
                    setElementData(aplayer,"Punkt",kwota)
                    --givePlayerMoney ( aplayer, kwota )
                    
             outputChatBox ( "Punkty dodane" )

else 
    outputChatBox ( "Nieudana proba dodania Punkty." )

end 
end
end )


oraz kod :

local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)




Zamie? na :


local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
        triggerEvent("addScore", localPlayer, 1)
        outputChatBox("bla bla bla wjechales w marker i teraz masz punktow: "..getElementData(localPlayer, "Punkt"))
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)




daj znac czy dzia?a

ps. element data sie kasuje po wyjsciu z serwera, wiec nie zdziw sie jezeli nie bedziesz mial punktow po ponownym wejsciu na serwer. dodatkowo przy onPlayerJoin znow ustawiasz punkty na 0

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-09, 17:26


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"Jurandovsky" napisał/a:

setElementData(aplayer,"Punkt",kwota) proponuje zmienic na :
setElementData(aplayer,"Punkt", getElementData(aplayer, "Punkt") + kwota)

kod:


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score")
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do
        setElementData(thePlayer,"Punkt",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Punkt",0)
end)

function addScore(points)
    setElementData(source, "points", getElementData(source, "points") + points)
end

addEvent("addScore", true)
addEventHandler("addScore", getRootElement(), addScore)
---------dawanie score

addCommandHandler ( "dajpunkt",
function ( player, cmd, nick, kwota )


        if nick and kwota then
            local aplayer = getPlayerFromName ( nick )
            if aplayer then
                kwota = tonumber(kwota)
           
                    setElementData(aplayer,"Punkt",kwota)
                    --givePlayerMoney ( aplayer, kwota )
                    
             outputChatBox ( "Punkty dodane" )

else
      outputChatBox( "Nie jestes H@", getRootElement())   
    outputChatBox ( "Nieudana proba dodania Punkty." )

end 
end
end )


zamie? na :


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score")
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do
        setElementData(thePlayer,"Punkt",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Punkt",0)
end)

function addScore(points)
    setElementData(source, "Punkt", getElementData(source, "Punkt") + points)
end

addEvent("addScore", true)
addEventHandler("addScore", getRootElement(), addScore)
---------dawanie score

addCommandHandler ( "dajpunkt",
function ( player, cmd, nick, kwota )


        if nick and kwota then
            local aplayer = getPlayerFromName ( nick )
            if aplayer then
                kwota = tonumber(kwota)
           
                    setElementData(aplayer,"Punkt",kwota)
                    --givePlayerMoney ( aplayer, kwota )
                    
             outputChatBox ( "Punkty dodane" )

else 
    outputChatBox ( "Nieudana proba dodania Punkty." )

end 
end
end )


oraz kod :

local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)




Zamie? na :


local districtsBus = {
    {-2267.09, 513.41, 35.21},
    {-2361.05, 508.25, 29.70},
    {-2334.35, 446.11, 33.93},
    {-2251.87, 324.60, 35.32},
    {-2252.09, 137.86, 35.32},
    {-2255.90, -53.92, 35.32},
    {-2179.74, -70.35, 35.32},
    {-2157.58, 29.73, 35.32},
    {-2008.12, 32.28, 32.92},
    {-2006.04, 152.42, 27.70},
    {-2003.16, 327.24, 35.20},
    {-2000.66, 582.50, 35.20},
    {-1866.77, 602.79, 35.20},
    {-1711.04, 640.27, 24.82},
    {-1658.49, 728.29, 17.35},
    {-1542.51, 753.95, 7.20},
    {-1554.45, 849.46, 7.20},
    {-1737.17, 849.34, 24.89},
    {-1941.91, 849.34, 40.29},
    {-1906.05, 920.55, 35.20},
    {-1671.73, 920.66, 24.82},
    {-1568.30, 1005.91, 7.20},
    {-1619.79, 1233.35, 7.20},
    {-1880.92, 1348.59, 7.20},
    {-2094.87, 1274.71, 15.28},
    {-2265.25, 1182.31, 55.78},
    {-2265.34, 928.57, 66.66},
    {-2265.42, 724.64, 49.49},
    {-2265.30, 548.17, 35.22},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh",resourceRoot,jobVehicle)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 2, 0)
        triggerEvent("addScore", localPlayer, 1)
        outputChatBox("bla bla bla wjechales w marker i teraz masz punktow: "..getElementData(localPlayer, "Punkt"))
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4,23,214,255,140)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* |NoName Polski Serwer RPG|Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)


addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* |NoName Polski Serwer RPG|Zako?czy?e? prac?")
        end
    end
end)




daj znac czy dzia?a

ps. element data sie kasuje po wyjsciu z serwera, wiec nie zdziw sie jezeli nie bedziesz mial punktow po ponownym wejsciu na serwer. dodatkowo przy onPlayerJoin znow ustawiasz punkty na 0

tylko na czacie mam info ze bla bla bla wjechales w marker i teraz masz punktow: 69 a nic nie dostaje

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-09, 17:27


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Ca?y czas jak wjezdzasz w markery masz 69 punktow?

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-09, 17:33


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"Jurandovsky" napisał/a:

Ca?y czas jak wjezdzasz w markery masz 69 punktow?

Tak

[ Dodano: 2016-08-10, 16:44 ]
Poradzi?em sobie ju? z tym problemem dzi?ki ka?demu za pomoc

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Tagi: punkty :: prace
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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