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

Wysłany: 2015-07-18, 11:33


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Witam mam problem z usuwaniem pojazdu poniewasz usuwa pojazd ale jak ktos w nim jest i wyjdzie z gry to ju? nie usuwa mo?e kto? mi pomoc troch? poprawi? skrypt ?
Za pomoc :piwo: :piwo:

kod
Kod:


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(437, x,y,z,0.0, 0, 180)

setElementData(bus, "zrespilGracz", el)
setElementData(bus, "pojazd_paliwo", 3)
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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-19, 03:23


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Musisz dodac event onClientQuit i tam destroyVeh

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-19, 13:41


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

A by m?g? kto? mi ten kod poprawi? ? bo niestety jak ja zrobi?em to nie dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-19, 20:39


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

addEventHandler("onPlayerQuit"resourceRoot, function(plrseat)
    if seat ~= 0 then return end
    destroyElement(source)
    triggerClientEvent(plr"destroyVeh"resourceRoot)
end)

Powinno dzia?a? nie testowa?em

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-20, 15:32


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Nie. Nie b?dzie.
addEventHandler("onPlayerQuit"root, function()
triggerEvent("destroyVeh"source)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-21, 11:22


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Zobacze czy dziala i dam znac ;)

[ Dodano: 2015-07-21, 13:24 ]
Ok dzia?a piwko leci dla was

Postaw piwo autorowi tego posta
 

 
Tagi: destroy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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