Wysłany: 2016-02-16, 18:06
MetalmenPL
Wiek: 25 Na forum: 3854 dni Posty: 2
Nick w MP: Metal
Potrzebuj? pomocy ot?? skrypt kt?ry napisa?em ( praca ) nie daje pieni?dzy ...
Oto Kod : Na C.
Kod: local districtsBus = {
{
-1985.46484375, 72.0615234375, 27.953262329102},
{-1987.7734375, 66.0009765625, 28.20802116394},
{-1982.232421875, 61.4873046875, 28.397748947144},
{-1975.87890625, 54.33984375, 28.820150375366},
{-1979.0498046875, 42.4169921875, 30.257034301758},
{-1987.0859375, 44.1552734375, 30.382406234741},
{-1992.884765625, 42.53515625, 31.611793518066},
{-1986.7724609375, 39.0703125, 31.022226333618},
{-1983.4111328125, 35.2568359375, 31.097345352173},
{-1978.9111328125, 29.7802734375, 31.77773475647},
{-1976.244140625, 40.6865234375, 30.465520858765},
{-1967.7197265625, 50.033203125, 29.339172363281},
{-1963.4794921875, 60.6533203125, 28.409980773926},
{-1963.546875, 66.1484375, 28.088659286499},
{-1968.9736328125, 67.52734375, 28.111268997192},
{-1968.015625, 73.3701171875, 27.749971389771},
{-1980.62890625, 71.923828125, 27.959045410156},
{-1992.4296875, 69.5458984375, 28.074096679688},
{-1993.462890625, 64.068359375, 28.889764785767},
{-1989.5576171875, 56.416015625, 29.259981155396},
{-1982.267578125, 59.7333984375, 28.471450805664},
{-1984.201171875, 73.5771484375, 27.889549255371},
}
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", localPlayer)
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("[Informacja] Zako?czy?e?/a? prac? kosiarek!")
else
showMarker()
playSoundFrontEnd(12)
triggerServerEvent("givePlayerMoney", localPlayer, 5, 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, 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)
outputChatBox("[Informacja] Rozpocz??e?/a? prac? kosiarek!")
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("[Informacja] Zako?czy?e? prac?")
end
end
end)
Tutaj na S :
Kod: local m1 = createMarker(-1998.69, 70.68, 28.62, "cylinder", 4.0, 255, 0, 0)
vehs = {}
function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end
addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
outputChatBox("[Informacja] Praca w trakcie poprawek", el)
return
end
if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
local x,y,z = getElementPosition(el)
local bus = createVehicle(572, x,y,z,-1992.3388671875, 75.3896484375, 27.813388824463)
setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 50)
setElementData(bus, "pojazd_przebieg", 100)
warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
vehs[el] = bus
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)
Ostatnio zmieniony przez marcin778 2018-04-28, 20:15, w całości zmieniany 1 raz
Wysłany: 2016-02-16, 18:49
Emm
***** ***
Wiek: 32 Na forum: 3880 dni Posty: 3191
Nick w MP: Emm
Piwa : 6162
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Z?y dzia?..
Dobra, pomog? Ci w tym w?tku, bo kto? ju? go zg?osi? i nie mog? poprosi? o przesuni?cie do dobrego dzia?u:
client
local districtsBus = {
{
- 1985.46484375 , 72.0615234375 , 27.953262329102 },
{- 1987.7734375 , 66.0009765625 , 28.20802116394 },
{- 1982.232421875 , 61.4873046875 , 28.397748947144 },
{- 1975.87890625 , 54.33984375 , 28.820150375366 },
{- 1979.0498046875 , 42.4169921875 , 30.257034301758 },
{- 1987.0859375 , 44.1552734375 , 30.382406234741 },
{- 1992.884765625 , 42.53515625 , 31.611793518066 },
{- 1986.7724609375 , 39.0703125 , 31.022226333618 },
{- 1983.4111328125 , 35.2568359375 , 31.097345352173 },
{- 1978.9111328125 , 29.7802734375 , 31.77773475647 },
{- 1976.244140625 , 40.6865234375 , 30.465520858765 },
{- 1967.7197265625 , 50.033203125 , 29.339172363281 },
{- 1963.4794921875 , 60.6533203125 , 28.409980773926 },
{- 1963.546875 , 66.1484375 , 28.088659286499 },
{- 1968.9736328125 , 67.52734375 , 28.111268997192 },
{- 1968.015625 , 73.3701171875 , 27.749971389771 },
{- 1980.62890625 , 71.923828125 , 27.959045410156 },
{- 1992.4296875 , 69.5458984375 , 28.074096679688 },
{- 1993.462890625 , 64.068359375 , 28.889764785767 },
{- 1989.5576171875 , 56.416015625 , 29.259981155396 },
{- 1982.267578125 , 59.7333984375 , 28.471450805664 },
{- 1984.201171875 , 73.5771484375 , 27.889549255371 },
}
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" , localPlayer )
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 ( "[Informacja] Zako?czy?e?/a? prac? kosiarek!" )
else
showMarker ()
playSoundFrontEnd ( 12 )
triggerServerEvent ( "givePlayerMoney" , localPlayer , 5 , 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 , 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 )
outputChatBox ( "[Informacja] Rozpocz??e?/a? prac? kosiarek!" )
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 ( "[Informacja] Zako?czy?e? prac?" )
end
end
end )
server
local m1 = createMarker (- 1998.69 , 70.68 , 28.62 , "cylinder" , 4.0 , 255 , 0 , 0 )
vehs = {}
addEvent ( "givePlayerMoney" , true )
addEventHandler ( "givePlayerMoney" , getRootElement (),function( ile )
givePlayerMoney ( source , tonumber ( ile ))
end )
function removePreviousVehicles ( plr )
for i , v in ipairs ( getElementsByType ( "vehicle" , resourceRoot )) do
local sby = getElementData ( v , "zrespilGracz" )
if sby and sby == plr and getPedOccupiedVehicle ( plr ) ~= v then
destroyElement ( v )
end
end
end
addEventHandler ( "onMarkerHit" , m1 , function( el , md )
if getElementData ( el , "zrespilGracz" ) then
outputChatBox ( "[Informacja] Praca w trakcie poprawek" , el )
return
end
if not md or getElementType ( el ) ~= "player" or getPedOccupiedVehicle ( el ) then return end
local x , y , z = getElementPosition ( el )
local bus = createVehicle ( 572 , x , y , z ,- 1992.3388671875 , 75.3896484375 , 27.813388824463 )
setElementData ( bus , "zrespilGracz" , el )
setElementData ( bus , "pojazd_paliwo" , 50 )
setElementData ( bus , "pojazd_przebieg" , 100 )
warpPedIntoVehicle ( el , bus )
removePreviousVehicles ( el )
triggerClientEvent ( el , "STARTJobBus" , resourceRoot , bus )
vehs [ el ] = bus
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 )
Podpis
Użytkownik : 20.10.2015r
GTAO Member : 06.03.2016r
Support-Team : 20.01.2016r
Moderator : 30.03.2016r
Mod-Team : 08.10.2016r
Vice Admin : 04.05.2018r
Administrator : 03.05.2022r
[you]
! 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 .
Wysłany: 2016-02-16, 18:52
Snapig
Amator LUA
Wiek: 28 Na forum: 3793 dni Posty: 43
Nick w MP: Rother
Piwa : 129
Za Metalmen napisze dziekuje ci Emm :> leci dla cb repka i piwko za wielka pomoc :>
Podpis
[you]
Jeżeli Ci pomogłem daj Piwko ;piwo;
Tagi: niedziałający :: skrypt
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: