GabWas, czyli jak bym chcia? doda? trzeci? tras? to co? takiego :
trasa = math.random(1,2,3)
if trasa==1 then
districtsBus = districtsBus1
elseif trasa==2 then
districtsBus = districtsBus2
elseif trasa==3 then
districtsBus = districtsBus3
end
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
local districtsBus1 = {
{-2019.83032,462.40048,35.17229},
{-2006.79102,408.72031,34.79565},
{-2008.52344,265.10687,31.36655},
{-2008.97949,116.47514,27.31794},
{-2120.60767,112.31438,34.95283},
{-2169.56055,44.05518,34.95201},
{-2169.59644,-56.73763,34.94774},
{-2393.76270,-68.54819,34.94443},
{-2635.83081,-68.07608,3.95697},
{-2785.24292,-68.43432,6.81854},
{-2807.52734,5.93914,6.80931}, -- prosta lewa strona mapy
{-2807.09766,181.73575,6.80850},
{-2809.35742,307.21472,5.62611},
{-2851.80933,399.29401,4.13669},
{-2825.35376,464.60773,4.33841},
{-2642.53076,466.28339,13.48236},
{-2604.78149,547.02252,14.23979},
{-2520.24170,562.22870,14.24022},
{-2367.01318,562.93127,24.51938},
{-2273.58472,562.84485,35.01563},
{-2107.74243,562.57837,35.01563},
{-2009.17590,558.70898,35.01563},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus2 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus3 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", resourceRoot, function()
givePlayerMoney (localPlayer, 2)
end)
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("* Zako?czy?e?/a? prac? StreetView.")
else
showMarker()
playSoundFrontEnd(12)
givePlayerMoney (10)
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, 0, 0, 255)
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)
trasa = math.random(1,3)
if trasa==1 then
districtsBus = districtsBus1
elseif trasa==2 then
districtsBus = districtsBus2
elseif trasa==3 then
districtsBus = districtsBus3
end
outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
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("* Zako?czy?e? prac? StreetView")
end
end
end)
Uwzgl?dni?em w nim 3 trasy, tylko tam sobie koordynaty pozmieniaj. Co do pewno?ci czy dzia?a to nie mam, bo nie otrzyma?em ca?ego skryptu. Tak czy siak, powodzenia
local districtsBus1 = {
{-2019.83032,462.40048,35.17229},
{-2006.79102,408.72031,34.79565},
{-2008.52344,265.10687,31.36655},
{-2008.97949,116.47514,27.31794},
{-2120.60767,112.31438,34.95283},
{-2169.56055,44.05518,34.95201},
{-2169.59644,-56.73763,34.94774},
{-2393.76270,-68.54819,34.94443},
{-2635.83081,-68.07608,3.95697},
{-2785.24292,-68.43432,6.81854},
{-2807.52734,5.93914,6.80931}, -- prosta lewa strona mapy
{-2807.09766,181.73575,6.80850},
{-2809.35742,307.21472,5.62611},
{-2851.80933,399.29401,4.13669},
{-2825.35376,464.60773,4.33841},
{-2642.53076,466.28339,13.48236},
{-2604.78149,547.02252,14.23979},
{-2520.24170,562.22870,14.24022},
{-2367.01318,562.93127,24.51938},
{-2273.58472,562.84485,35.01563},
{-2107.74243,562.57837,35.01563},
{-2009.17590,558.70898,35.01563},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus2 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus3 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", resourceRoot, function()
givePlayerMoney (localPlayer, 2)
end)
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("* Zako?czy?e?/a? prac? StreetView.")
else
showMarker()
playSoundFrontEnd(12)
givePlayerMoney (10)
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, 0, 0, 255)
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)
trasa = math.random(1,3)
if trasa==1 then
districtsBus = districtsBus1
elseif trasa==2 then
districtsBus = districtsBus2
elseif trasa==3 then
districtsBus = districtsBus3
end
outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
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("* Zako?czy?e? prac? StreetView")
end
end
end)
Podpis
Ostatnio zmieniony przez OskarYT 2016-06-22, 22:09, w całości zmieniany 1 raz
Pozmienia?em kolejno?? zmiennych (tak wiem, mas?o ma?lane), przetestowa?em - no i dzia?a Licz? na i/lub
Kod zmieni? si? tylko po stronie clienta, oto on:
local districtsBus = {}
local districtsBus1 = {
{-2019.83032,462.40048,35.17229},
{-2006.79102,408.72031,34.79565},
{-2008.52344,265.10687,31.36655},
{-2008.97949,116.47514,27.31794},
{-2120.60767,112.31438,34.95283},
{-2169.56055,44.05518,34.95201},
{-2169.59644,-56.73763,34.94774},
{-2393.76270,-68.54819,34.94443},
{-2635.83081,-68.07608,3.95697},
{-2785.24292,-68.43432,6.81854},
{-2807.52734,5.93914,6.80931}, -- prosta lewa strona mapy
{-2807.09766,181.73575,6.80850},
{-2809.35742,307.21472,5.62611},
{-2851.80933,399.29401,4.13669},
{-2825.35376,464.60773,4.33841},
{-2642.53076,466.28339,13.48236},
{-2604.78149,547.02252,14.23979},
{-2520.24170,562.22870,14.24022},
{-2367.01318,562.93127,24.51938},
{-2273.58472,562.84485,35.01563},
{-2107.74243,562.57837,35.01563},
{-2009.17590,558.70898,35.01563},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus2 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
local districtsBus3 = {
{-2039.78931,461.50751,35.17188},
{-2008.12476,470.15121,35.01563},
{-2039.78931,461.50751,35.17188},
}
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", resourceRoot, function()
givePlayerMoney (localPlayer, 2)
end)
local jobTarget
local jobMarker
local jobVehicle
addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
trasa = math.random(1,3)
if trasa==1 then
districtsBus = districtsBus1
elseif trasa==2 then
districtsBus = districtsBus2
elseif trasa==3 then
districtsBus = districtsBus3
end
maxTarget = #districtsBus
outputChatBox("* Rozpocz??e?/a? prac? StreetView.")
outputChatBox("* Je?dzij po punktach i uzupe?niaj map?.")
jobVehicle = veh
jobTarget = 0
showMarker()
end)
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("* Zako?czy?e?/a? prac? StreetView.")
else
showMarker()
playSoundFrontEnd(12)
givePlayerMoney (10)
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, 0, 0, 255)
if districtsBus[jobTarget+1] then
ile = districtsBus[jobTarget+1]
setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
end
addEventHandler("onClientMarkerHit", jobMarker, busDriver)
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("* Zako?czy?e? prac? StreetView")
end
end
end)
Nie jestem tylko pewien czy dzia?a to z wi?cej ni? jedn? osob?, b?dziesz musia? to z kim? sprawdzi?. Tak czy siak, mam nadziej? ?e pomog?em
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