MichalskY
Wiek: 31 Na forum: 3405 dni Posty: 24
Witam, mam problem z dodaniem blip?w do "missionPointsD" na radarze. Og?lnie to pr?bowa?em je zrobi? i odziwo mi si? uda?o lecz po wleceniu w markery one nie znika?y. dam czysty kod mo?e kto? z was by to wykona?. (pisalem w pro?bie o przerobienie skryptu ale nikt sie nie odzywa -,- )
createBlip ( 1393.81 , 1251.28 , 10.82 , 46 , 2 , 255 , 0 , 0 , 255 , 0 , 400 )
local missionTimer
local missionVehicle
local missionWysypiskaD = {
{ 1393.81 , 1251.28 , 10.82 },
}
local missionPointsD = {
{ 1510.02 , 1469.23 , 183.85 },
{ 1454.08 , 1620.11 , 183.85 },
{ 1339.48 , 1593.27 , 183.85 },
{ 1432.73 , 1780.46 , 71.95 },
{ 1428.17 , 1948.34 , 62.25 },
{ 1437.01 , 2124.77 , 42.10 },
{ 1487.96 , 2203.80 , 69.20 },
{ 1538.71 , 2197.85 , 69.20 },
{ 1657.53 , 2177.71 , 69.20 },
}
local countMarkers = #missionPointsD
for i , v in ipairs ( missionWysypiskaD ) do
local marker = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 1 , "cylinder" , 4 , 0 , 71 , 255 , 100 )
createPickup ( v [ 1 ], v [ 2 ], v [ 3 ]+ 1 , 3 , 1318 )
setElementData ( marker , "wysypisko" , true )
-- createBlipAttachedTo ( marker , 52 )
local t = createElement ( "text" )
setElementData ( t , "name" , "Miejsce oddania\nzebranych danych!" )
setElementPosition ( t , v [ 1 ], v [ 2 ], v [ 3 ])
end
function showMarker ()
for i , rnd in ipairs ( missionPointsD ) do
markerr = createMarker ( rnd [ 1 ], rnd [ 2 ], rnd [ 3 ], "arrow" , 7 , 0 , 80 , 180 , 255 )
setElementData ( markerr , "wlasnosc" , getPlayerName ( localPlayer ))
end
end
addEventHandler ( "onClientVehicleExit" , root ,function ( plr , seat )
if plr == localPlayer and seat == 0 and getElementData ( source , "zapelnienie" ) then
triggerServerEvent ( "cancelJob" , resourceRoot , source )
setElementData ( plr , "player:job" , nil )
for i , v in ipairs ( getElementsByType ( "marker" )) do
if getElementData ( v , "wlasnosc" ) == getPlayerName ( plr ) then
destroyElement ( v )
end
end
end
end )
addEventHandler ( "onClientMarkerHit" , resourceRoot , function( el , md )
if el ~= localPlayer then return end
local veh = getPedOccupiedVehicle ( localPlayer )
if not veh then return end -- nie powinno sie wydarzyc
if getVehicleController ( veh ) ~= localPlayer then return end
if getElementData ( veh , "vehicle:pracaD" ) and getElementData ( veh , "vehicle:pracaD" )== "Dodo" then
if getElementData ( source , "wysypisko" ) then
local zapelnienie = getElementData ( veh , "zapelnienie" )
-- outputChatBox ( zapelnienie )
if zapelnienie and zapelnienie == 0 then -- procenty
outputChatBox ( "#0055B5☞ #FFFFFFTw?j dysk jest pusty." , 255 , 255 , 255 , true )
return
end
if countMarkers == 0 then
showMarker ()
end
setElementData ( veh , "zapelnienie" , 0 )
setElementData ( veh , "vehicle:desc" , "Dane 0%" )
triggerServerEvent ( "wyplacPieniadze" , localPlayer , zapelnienie )
return
end
if countMarkers == 0 then
showMarker ()
else
local zapelnienie = getElementData ( veh , "zapelnienie" )
if zapelnienie and zapelnienie >= 100 then -- procenty
outputChatBox ( "#0055B5☞ #FFFFFFPosiadasz ju? #919191: " .. zapelnienie .. "#0053FFGB." , 255 , 0 , 0 , true )
return
end
marker = source
-- outputChatBox ( "#0053FF Trwa Ladowanie..." , 0 , 0 , 0 , true )
if not isTimer ( missionTimer ) then
missionTimer = setTimer (function()
countMarkers = countMarkers - 1
local poziom = getElementData ( veh , "zapelnienie" ) or 0
poziom = math . min ( poziom + math . random ( 1 , 3 ), 100 )
setElementData ( veh , "zapelnienie" , poziom )
setElementData ( veh , "vehicle:desc" , "Dane: " .. poziom .. "%" )
outputChatBox ( "#0055B5☞ #FFFFFFZawartosc Dysku#919191: " .. poziom .. "%" , 0 , 0 , 0 , true )
destroyElement ( marker )
end , 500 , 1 )
else
killTimer ( missionTimer )
end
end
end
end )
setTimer (function()
for _ , player in ipairs ( getElementsByType ( "player" )) do
if getElementData ( player , "player:job" ) == "Generator" then
if not getPedOccupiedVehicle ( player ) and getPedOccupiedVehicle ( player ) ~= missionVehicle then
for _ , marker in ipairs ( getElementsByType ( "marker" , resourceRoot )) do
if getElementData ( marker , "wlasnosc" ) == getPlayerName ( player ) then
destroyElement ( marker )
setElementData ( player , "player:job" , false )
end
end
end
end
end
end , 1000 , 0 )
addEventHandler ( "onClientVehicleEnter" , resourceRoot , function( plr , seat )
if plr ~= localPlayer then return end
if seat ~= 0 then return end
missionVehicle = source
setElementData ( source , "zapelnienie" , 0 )
setElementData ( source , "vehicle:desc" , "Dane: 0%" )
setElementData ( plr , "player:job" , "Generator" )
outputChatBox ( "#0055B5☞ #FFFFFFRozpoczynasz prace, lataj nad #0055B5Las Venturas i zbieraj dane." , 255 , 255 , 255 , true )
outputChatBox ( "#0055B5☞ #FFFFFFPo uzbieraniu min 1% mozesz odeslac zapisana mape na #0053FFStacji#919191." , 255 , 255 , 255 , true )
outputChatBox ( "#0055B5☞ #FFFFFFOznaczonej #0055B5W #FFFFFF na lotnisku LV." , 255 , 255 , 255 , true )
showMarker ()
end )
addEventHandler ( "onClientResourceStop" , resourceRoot , function()
if getElementData ( localPlayer , "player:job" ) == "Dodo" then
setElementData ( localPlayer , "player:job" , false )
end
end )