Wysłany: 2018-04-02, 14:50
readreis
Wiek: 37 Na forum: 3908 dni Posty: 62
Piwa : 4
Witam mam problem poniewa? gdy resetuje prace autobusy to sa 3 trasy i kazda dziala poprawnie lecz po chwili trasa 1 robi sie trasa 2 i sa tylko 2 trasy. Za pomoc daje
I jeszcze czy mozna jakos zrobic zeby tylko gracz ktory posiada np kat.c prawko moze tylko pracowac tutaj
bus_c
--[[
Praca busa
]]--
local code = "Autobusy"
local districtsBus
local districtsBus = {
{- 1510.31 , 744.04 , 8.34 },
{- 1543.25 , 722.96 , 8.17 },
{- 1535.81 , 792.54 , 8.17 },
{- 1525.36 , 900.56 , 8.18 },
{- 1577.98 , 1027.95 , 8.17 },
{- 1581.30 , 1163.18 , 8.18 },
{- 1679.03 , 1298.93 , 8.18 },
{- 1813.48 , 1384.91 , 8.18 },
{- 1981.38 , 1311.87 , 8.18 },
{- 2110.66 , 1276.92 , 19.21 },
{- 2237.84 , 1276.99 , 40.98 },
{- 2270.13 , 1156.74 , 59.28 },
{- 2269.33 , 1016.83 , 84.74 },
{- 2269.72 , 866.64 , 67.63 },
{- 2270.28 , 688.38 , 50.43 },
{- 2373.26 , 670.63 , 36.22 },
{- 2390.14 , 575.14 , 25.79 },
{- 2519.81 , 569.83 , 15.58 },
{- 2638.31 , 569.33 , 15.60 },
{- 2746.82 , 570.02 , 15.55 },
{- 2707.95 , 457.14 , 5.32 },
{- 2752.48 , 403.60 , 5.27 },
{- 2714.97 , 333.88 , 5.32 },
{- 2708.07 , 217.64 , 5.31 },
{- 2708.34 , 98.11 , 5.32 },
{- 2708.42 , 22.10 , 5.33 },
{- 2708.48 ,- 64.32 , 5.38 },
{- 2623.18 ,- 72.36 , 5.32 },
{- 2502.88 ,- 72.94 , 26.95 },
{- 2389.62 ,- 72.57 , 36.31 },
{- 2283.48 ,- 72.71 , 36.31 },
{- 2180.94 ,- 73.11 , 36.31 },
{- 2047.15 ,- 73.21 , 36.30 },
{- 1957.38 ,- 66.36 , 26.99 },
{- 1854.50 ,- 120.20 , 7.29 },
{- 1796.49 ,- 94.14 , 8.57 },
{- 1799.10 , 16.82 , 16.09 },
{- 1806.28 , 131.96 , 16.10 },
{- 1803.30 , 238.66 , 16.09 },
{- 1715.29 , 333.94 , 8.16 },
{- 1616.82 , 431.44 , 8.17 },
{- 1554.71 , 593.97 , 8.21 },
{- 1536.40 , 698.41 , 8.28 },
}
local districtsBus2 = {
{- 1503.46 , 743.46 , 6.59 },
{- 1531.71 , 721.61 , 6.59 },
{- 1561.58 , 676.06 , 6.44 },
{- 1561.89 , 585.88 , 6.44 },
{- 1569.33 , 499.49 , 6.44 },
{- 1623.33 , 437.03 , 6.44 },
{- 1688.28 , 371.75 , 6.44 },
{- 1762.32 , 297.34 , 6.69 },
{- 1811.00 , 182.67 , 14.37 },
{- 1805.05 , 66.88 , 14.37 },
{- 1800.74 ,- 23.20 , 14.37 },
{- 1800.04 ,- 142.74 , 5.76 },
{- 1800.07 ,- 226.99 , 17.70 },
{- 1806.60 ,- 351.30 , 20.17 },
{- 1818.48 ,- 429.13 , 14.30 },
{- 1820.11 ,- 565.24 , 15.72 },
{- 1912.93 ,- 576.63 , 23.84 },
{- 2033.19 ,- 576.05 , 27.11 },
{- 2023.74 ,- 619.88 , 30.78 },
{- 1990.16 ,- 710.87 , 31.42 },
{- 1990.00 ,- 846.84 , 31.43 },
{- 1990.70 ,- 989.03 , 31.43 },
{- 1921.10 ,- 988.90 , 31.39 },
{- 1921.58 ,- 849.32 , 31.42 },
{- 1950.36 ,- 713.86 , 31.42 },
{- 2027.48 ,- 608.47 , 30.52 },
{- 2135.34 ,- 508.63 , 37.57 },
{- 2237.20 ,- 400.13 , 50.28 },
{- 2252.00 ,- 287.26 , 45.95 },
{- 2271.66 ,- 189.28 , 34.58 },
{- 2368.51 ,- 166.88 , 34.59 },
{- 2370.81 ,- 73.36 , 34.69 },
{- 2476.60 ,- 68.99 , 28.76 },
{- 2603.50 ,- 68.77 , 3.71 },
{- 2604.98 ,- 188.55 , 3.59 },
{- 2698.43 ,- 209.70 , 3.59 },
{- 2705.43 ,- 129.62 , 3.58 },
{- 2704.94 ,- 21.02 , 3.59 },
{- 2704.42 , 95.06 , 3.58 },
{- 2720.29 , 160.75 , 4.14 },
{- 2804.97 , 158.84 , 6.42 },
{- 2806.94 , 284.74 , 6.44 },
{- 2705.37 , 298.44 , 3.59 },
{- 2662.68 , 360.79 , 3.59 },
{- 2704.68 , 424.83 , 3.59 },
{- 2632.66 , 465.62 , 13.87 },
{- 2604.78 , 548.15 , 13.86 },
{- 2527.05 , 583.14 , 14.66 },
{- 2525.67 , 695.30 , 27.25 },
{- 2524.53 , 808.50 , 49.23 },
{- 2515.18 , 907.51 , 64.25 },
{- 2384.87 , 930.64 , 44.69 },
{- 2283.50 , 956.87 , 65.51 },
{- 2240.38 , 916.79 , 65.89 },
{- 2149.51 , 913.75 , 79.24 },
{- 2132.88 , 806.97 , 68.82 },
{- 2012.75 , 806.16 , 44.71 },
{- 2000.52 , 910.04 , 44.70 },
{- 1918.30 , 918.50 , 35.34 },
{- 1814.16 , 918.45 , 23.98 },
{- 1696.68 , 917.96 , 24.15 },
{- 1573.87 , 917.63 , 6.59 },
{- 1563.74 , 828.38 , 6.44 },
{- 1562.37 , 759.93 , 6.44 },
{- 1536.56 , 697.28 , 6.60 },
}
local districtsBus3 = {
{- 1511.19 , 744.25 , 6.57 },
{- 1531.93 , 722.22 , 6.59 },
{- 1562.44 , 688.78 , 6.44 },
{- 1562.47 , 566.04 , 6.44 },
{- 1603.59 , 454.22 , 6.44 },
{- 1683.23 , 373.73 , 6.44 },
{- 1726.17 , 330.30 , 6.44 },
{- 1789.81 , 353.61 , 16.07 },
{- 1863.92 , 415.47 , 16.41 },
{- 1917.29 , 345.65 , 29.89 },
{- 2006.74 , 348.21 , 34.42 },
{- 2008.62 , 235.04 , 28.07 },
{- 2008.56 , 132.53 , 26.95 },
{- 2008.87 , 47.72 , 30.91 },
{- 2008.16 ,- 47.75 , 34.58 },
{- 2075.15 ,- 68.77 , 34.58 },
{- 2085.36 , 18.89 , 34.58 },
{- 2166.46 , 30.52 , 34.58 },
{- 2170.93 ,- 64.69 , 34.56 },
{- 2273.57 ,- 68.78 , 34.57 },
{- 2370.53 ,- 59.44 , 34.58 },
{- 2365.49 , 33.05 , 34.58 },
{- 2273.41 , 48.12 , 34.57 },
{- 2250.11 , 126.03 , 34.58 },
{- 2249.89 , 240.92 , 34.57 },
{- 2251.01 , 340.17 , 33.52 },
{- 2321.13 , 435.70 , 34.10 },
{- 2383.86 , 551.19 , 24.44 },
{- 2282.68 , 562.32 , 34.43 },
{- 2254.06 , 649.64 , 48.65 },
{- 2255.25 , 727.05 , 48.70 },
{- 2149.92 , 728.51 , 68.78 },
{- 2021.81 , 727.96 , 45.95 },
{- 1898.74 , 727.82 , 44.70 },
{- 1895.63 , 875.48 , 34.42 },
{- 1812.82 , 916.42 , 24.07 },
{- 1649.52 , 916.45 , 19.41 },
{- 1565.48 , 916.86 , 6.45 },
{- 1561.83 , 822.46 , 6.44 },
{- 1562.18 , 747.15 , 6.45 },
{- 1536.85 , 699.07 , 6.59 },
}
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
if getElementData ( localPlayer , "player:job" ) == code then
setElementData ( localPlayer , "player:job" , false )
end
triggerServerEvent ( "destroyVeh" , localPlayer )
end
addEventHandler ( "onClientPlayerWasted" , getLocalPlayer (), finishJob )
addEvent ( "finishJob" , true )
addEventHandler ( "finishJob" , root ,function( plr )
if plr ~= localPlayer then return end
finishJob ()
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 ( 2 )
-- outputChatBox ( "#ffffff[#41E0FFInformacja#ffffff]#41E0FF Zako?czy?e?/a? prac?." , 255 , 255 , 255 , true )
addEventHandler ( "onClientRender" , root , render3 )
setTimer ( renderstop3 , 2000 , 1 )
else
kasa = math . random ( 800 , 1000 )
kasavip = math . random ( 800 , 1000 )* 1.3
showMarker ()
playSoundFrontEnd ( 12 )
if getElementData ( el , "player:premium" ) then
-- outputChatBox ( "* Zidentyfikowa?e?(a?) punkt i otrzymujesz 100 PLN." )
triggerServerEvent ( "givePlayerMoney" , el , kasavip , 0 )
setElementData ( el , "player:srp" , getElementData ( el , "player:srp" )+ math . random ( 0 , 1 ))
addEventHandler ( "onClientRender" , root , render6 )
setTimer ( renderstop6 , 1000 , 1 )
else
-- outputChatBox ( "* Zidentyfikowa?e?(a?) punkt i otrzymujesz 75 PLN." )
triggerServerEvent ( "givePlayerMoney" , el , kasa , 0 )
setElementData ( el , "player:srp" , getElementData ( el , "player:srp" )+ math . random ( 0 , 1 ))
addEventHandler ( "onClientRender" , root , render2 )
setTimer ( renderstop2 , 1000 , 1 )
end
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 , 255 , 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 = districtsBus
elseif trasa == 2 then
districtsBus = districtsBus2
elseif trasa == 3 then
districtsBus = districtsBus3
end
maxTarget = #districtsBus
addEventHandler ( "onClientRender" , root , render1 )
setTimer ( renderstop1 , 4000 , 1 )
-- 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 , "player:job" ) then
setElementData ( localPlayer , "player:job" , false )
end
end )
addEventHandler ( "onClientVehicleExit" , resourceRoot , function( plr , seat )
if seat == 0 then
if plr == localPlayer then
finishJob ()
-- outputChatBox ( "#ffffff[#41E0FFInformacja#ffffff]#41E0FF Zako?czy?e? prac?" , 255 , 255 , 255 , true )
addEventHandler ( "onClientRender" , root , render3 )
setTimer ( renderstop3 , 2000 , 1 )
end
end
end )
local screenW , screenH = guiGetScreenSize ()
function render1 ()
dxDrawText ( "Rozpocz??e? prac? Kierowcy PKS jed? po ludzi. \n Przydzielono ci lini? nr:" .. trasa , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function render2 ()
dxDrawText ( "Przystanek zaliczony. Otrzymujesz " .. kasa .. "PLN" , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function render3 ()
dxDrawText ( "Zako?czy?e? prac? kierowcy PKS'u." , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function render4 ()
dxDrawText ( "Zako?czy?e? prace kierowcy PKS'u." , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function render5 ()
dxDrawText ( "Posiadasz ju? aktywn? prac?." , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function render6 ()
dxDrawText ( "Przystanek zaliczony. Otrzymujesz " .. kasavip .. "PLN" , screenW * 0.3656 , screenH * 1.3553 , screenW * 0.6273 , screenH * 0.3193 , tocolor ( 255 , 255 , 255 , 255 ), 1.5 , "default" , "center" , "center" , false , false , false , false , false )
end
function renderstop1 ()
removeEventHandler ( "onClientRender" , root , render1 )
end
function renderstop2 ()
removeEventHandler ( "onClientRender" , root , render2 )
end
function renderstop3 ()
removeEventHandler ( "onClientRender" , root , render3 )
end
function renderstop4 ()
removeEventHandler ( "onClientRender" , root , render4 )
end
function renderstop5 ()
removeEventHandler ( "onClientRender" , root , render5 )
end
function renderstop6 ()
removeEventHandler ( "onClientRender" , root , render6 )
end
bus
createBlip (- 1520.40 , 690.76 , 7.19 , 46 , 2 , 255 , 0 , 0 , 255 , 0 , 100 )
local m1 = createMarker (- 1520.40 , 690.76 , 7.19 - 1 , "cylinder" , 1.5 , 35 , 142 , 35 , 100 )
local t = createElement ( 'text' )
setElementPosition ( t ,- 1520.40 , 690.76 , 7.19 )
setElementData ( t , "name" , "PRACA: Kierowca PKS\nZAROBEK:\nGRACZ od 800PLN do 1000 \n PREMIUM zarabia x1.3" )
local vehs = {}
local code = "Autobusy"
local zone = createColSphere ( - 1488.64 , 744.14 , 7.18 , 6 )
addEventHandler ( "onMarkerHit" , m1 , function( el , md )
if getElementData ( el , "vehicle_job_owner" ) then
return
end
if not md or getElementType ( el ) ~= "player" or getPedOccupiedVehicle ( el ) then return end
if getElementData ( el , "player:job" ) then return end
if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("[#00ff00INFORMACJA#ffffff]Kto? ju? zajmuje to miejsce, poczekaj a? odjedzie.",el,255,255,255,true) return end
local x , y , z = getElementPosition ( el )
local autbus = createVehicle ( 437 , - 1488.64 , 744.14 , 7.18 , 0.00 , 0 , 90 )
setElementFrozen ( el , true )
setElementData ( autbus , "vehicle:desc" , "Praca dorywcza\n Kierowca autobusu" )
setElementData ( autbus , "vehicle_job_owner" , el )
setElementData ( autbus , "vehicle:fuel" , 100000 )
setElementData ( autbus , "vehicle:mileage" , math . random ( 1000 , 1233 ))
setVehicleHandling ( autbus , "maxVelocity" , 80.0 )
setElementData ( el , "player:job" , code )
-- warpPedIntoVehicle ( el , autobus )
setTimer ( warpPedIntoVehicle , 200 , 1 , el , autbus )
setTimer ( setElementFrozen , 1000 , 1 , el , false )
triggerClientEvent ( el , "STARTJobBus" , resourceRoot , autbus )
vehs [ el ] = autbus
end )
addEvent ( "STOPJobBus" , true )
addEventHandler ( "STOPJobBus" , resourceRoot , function()
local pojazd = getPedOccupiedVehicle ( localPlayer )
if pojazd then
destroyElement ( pojazd )
end
end )
addEvent ( "destroyVeh" , true )
addEventHandler ( "destroyVeh" , getRootElement (),
function()
if vehs [ source ] then
if isElement ( vehs [ source ]) then destroyElement ( vehs [ source ]) end
end
end )
addEvent ( "onPlayerQuit" , true )
addEventHandler ( "onPlayerQuit" , getRootElement (), function()
if vehs [ source ] then
if isElement ( vehs [ source ]) then destroyElement ( vehs [ source ]) end
end
end )
local t = createElement ( "text" )
setElementData ( t , "scale" , 2 )
setElementData ( t , "name" , "Spawn autobus?w\nNie zastawia?!" )
setElementPosition ( t , - 1491.14 , 744.13 , 7.18 )
B??d w db3:
https://imgur.com/a/hWv9f
Wysłany: 2018-04-02, 15:29
NoKill1997
Online
Wiek: 28 Na forum: 3224 dni Posty: 183
Nick w MP: Mefedroniarz.PDW
Piwa : 778
Dodalem Ci wymagania prawka.
Server Side:
createBlip (- 1520.40 , 690.76 , 7.19 , 46 , 2 , 255 , 0 , 0 , 255 , 0 , 100 )
local m1 = createMarker (- 1520.40 , 690.76 , 7.19 - 1 , "cylinder" , 1.5 , 35 , 142 , 35 , 100 )
local t = createElement ( 'text' )
setElementPosition ( t ,- 1520.40 , 690.76 , 7.19 )
setElementData ( t , "name" , "PRACA: Kierowca PKS\nZAROBEK:\nGRACZ od 800PLN do 1000 \n PREMIUM zarabia x1.3" )
local vehs = {}
local code = "Autobusy"
local zone = createColSphere ( - 1488.64 , 744.14 , 7.18 , 6 )
addEventHandler ( "onMarkerHit" , m1 , function( el , md )
if getElementData ( el , "vehicle_job_owner" ) then
return
end
if not md or getElementType ( el ) ~= "player" or getPedOccupiedVehicle ( el ) then return end
if getElementData ( el , "player:job" ) then return end
if getElementData ( el , "player:license:pjC" ) < 1 then outputChatBox ( "[#00ff00INFORMACJA#ffffff]Aby pracowac na tej pracy musisz posiadac prawo jazdy kategorii C." , el , 255 , 255 , 255 , true ) return end
if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("[#00ff00INFORMACJA#ffffff]Kto? ju? zajmuje to miejsce, poczekaj a? odjedzie.",el,255,255,255,true) return end
local x , y , z = getElementPosition ( el )
local autbus = createVehicle ( 437 , - 1488.64 , 744.14 , 7.18 , 0.00 , 0 , 90 )
setElementFrozen ( el , true )
setElementData ( autbus , "vehicle:desc" , "Praca dorywcza\n Kierowca autobusu" )
setElementData ( autbus , "vehicle_job_owner" , el )
setElementData ( autbus , "vehicle:fuel" , 100000 )
setElementData ( autbus , "vehicle:mileage" , math . random ( 1000 , 1233 ))
setVehicleHandling ( autbus , "maxVelocity" , 80.0 )
setElementData ( el , "player:job" , code )
-- warpPedIntoVehicle ( el , autobus )
setTimer ( warpPedIntoVehicle , 200 , 1 , el , autbus )
setTimer ( setElementFrozen , 1000 , 1 , el , false )
triggerClientEvent ( el , "STARTJobBus" , resourceRoot , autbus )
vehs [ el ] = autbus
end )
addEvent ( "STOPJobBus" , true )
addEventHandler ( "STOPJobBus" , resourceRoot , function()
local pojazd = getPedOccupiedVehicle ( localPlayer )
if pojazd then
destroyElement ( pojazd )
end
end )
addEvent ( "destroyVeh" , true )
addEventHandler ( "destroyVeh" , getRootElement (),
function()
if vehs [ source ] then
if isElement ( vehs [ source ]) then destroyElement ( vehs [ source ]) end
end
end )
addEvent ( "onPlayerQuit" , true )
addEventHandler ( "onPlayerQuit" , getRootElement (), function()
if vehs [ source ] then
if isElement ( vehs [ source ]) then destroyElement ( vehs [ source ]) end
end
end )
local t = createElement ( "text" )
setElementData ( t , "scale" , 2 )
setElementData ( t , "name" , "Spawn autobus?w\nNie zastawia?!" )
setElementPosition ( t , - 1491.14 , 744.13 , 7.18 )
Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Więcej szczegółów
Wystawiono 1 piw(a):readreis
Wysłany: 2018-04-02, 15:44
readreis
Wiek: 37 Na forum: 3908 dni Posty: 62
Piwa : 4
NoKill1997 , Dzieki masz tylko jeszcze mam problem z tymi trasami ;/
Wysłany: 2018-04-02, 17:21
NoKill1997
Online
Wiek: 28 Na forum: 3224 dni Posty: 183
Nick w MP: Mefedroniarz.PDW
Piwa : 778
"readreis" napisał/a :NoKill1997 , Dzieki masz tylko jeszcze mam problem z tymi trasami ;/
Nie jest to blad trasy. Jest to blad jedynie renderu. Blad komunikatu pokazujacego Ci ile zarobiles. Na moje oko jest wszystko dobrze. Lecz jezeli nie potrzebujesz komunikatow w GUI to podmien render pod OutputChatbox, mozliwe ze unikniesz wtedy danego bledu.
Podpis
Aktualny projekt: LSgame
Na scenie MTA od: 2015 roku.
Discord: Chwilowoo, brak
Tagi: praca :: autobusy
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: