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

Wysłany: 2017-08-21, 15:50


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

Witam, mam skrypt na prace.. Jest to praca Nurka.. Ale niestety nie potrafie zrobic usuniecia pojazdu po 60 sekundach. Tzn. pojazd usuwa mi od razu po wyjsciu, a ja chce aby usuwalo go po 60 sekunach A oto kody:
client:
Kod:

--[[
Praca StreetView
Skrypt wykonal: Nikodem S. (NoKill)
]]--
local text=createElement("text")
local districtsBus = {
{-2184.58,-2356.55,30.47},
{-2169.67,-2340.81,30.47},
{-2158.11,-2325.75,30.47},
{-2160.49,-2306.73,30.47},
{-2192.00,-2281.82,30.47},
{-2265.60,-2220.81,30.32},
{-2165.55,-2150.53,50.96},
{-2082.33,-2017.06,61.91},
{-1991.33,-1864.71,41.40},
{-1831.20,-1733.15,29.12},
{-1663.72,-1639.33,36.26},
{-1541.88,-1588.72,37.73},
{-1718.37,-1481.05,34.49},
{-1903.30,-1375.03,40.13},
{-1901.91,-1339.67,40.34},
{-1897.04,-1262.76,39.48},
{-1821.43,-1212.52,38.46},
{-1872.41,-1154.33,29.95},
{-1968.87,-1140.94,29.85},
{-1986.16,-1026.65,32.02},
{-1971.44,-1006.86,32.02},
{-1948.94,-1008.65,32.02},
{-1949.56,-1064.47,31.64},
{ -1949.97,-1084.40,30.77},

}

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)
showMarker()
playSoundFrontEnd(12)
givePlayerMoney (25)
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("* Roczpocznij prace Sweeper.")
outputChatBox("* Jezdzij do punktach i Transportuj ludzi.")
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()
end
end
end)

server:
Kod:

local m1 = createMarker(-2342.82,-2847.52,0.54, "cylinder", 1.6, 32, 64, 255, 155)
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("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(473, -2341.47,-2860.46,-0.25,5.0,359.7,188.5)
setVehicleHandling(bus, "maxVelocity", 50.0)
setElementData(bus, "zrespilGracz", el)
setElementData(bus, "vehicle:fuel", 100)
setElementData(bus, "pojazd_przebieg", 100)

warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

vehs[el] = bus
end)

addEvent("stop:job", true)
addEventHandler("stop:job", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh",resourceRoot,function(veh)
if veh and isElement(veh) then
destroyElement(veh)
end
end)

Client i Server na respienie pojazdow wzialem z innego skrypta..

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-21, 15:59


SezamQ

CloudMTA






Wiek: 27
Na forum: 3210 dni
Posty: 12
Nick w MP: SezamQ

Piwa: 1

Respekt: 60

U?yj funkcji setTimer

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-21, 16:04


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8


addEvent("destroyVeh"trueaddEventHandler("destroyVeh",resourceRoot,function(veh)
setTimer(function() 
if veh and isElement(vehthen 
destroyElement(vehend600001)
end 
end)


Licz? na respekt.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
NoKill1997
Wysłany: 2017-08-21, 16:28


NoKill1997

Online






Wiek: 28
Na forum: 3224 dni
Posty: 183
Nick w MP: Mefedroniarz.PDW

Piwa: 778

Respekt: 80,5

"Kalizman" napisał/a:


addEvent("destroyVeh"trueaddEventHandler("destroyVeh",resourceRoot,function(veh)
setTimer(function() 
if veh and isElement(vehthen 
destroyElement(vehend600001)
end 
end)


Licz? na respekt.
Gdzie mam to dokladnie wkleic?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-08-21, 21:06


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Tam gdzie to masz w kodzie

Postaw piwo autorowi tego posta
 

 
Tagi: usuwanie :: pontonu :: sekundach
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Usuwanie pontonu po 60 sekundach Odpowiedz do tematu

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