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

Wysłany: 2016-07-17, 23:49


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

Witam mam taki problem ze po wgraniu skryptu na nie rozwalanie auta bez kierowcy
nadal auta mo?na rozwala? chocia? w nim nikogo niema
Kod:

local function bezkierowcy(veh)
local occupants = getVehicleOccupants(veh)
local seats = getVehicleMaxPassengers(veh)
if (not seats) then return true end
for i=0,seats do
local occupant = occupants[seat]
if occupant and (getElementType(occupant)=="player" or getElementType(occupant)=="ped") then
return false
end
end
return true
end


for i,v in ipairs(getElementsByType("vehicle")) do
if (bezkierowcy(v)) then
setVehicleDamageProof(v,true)
else
if getElementData(v,"damageproof") then setVehicleDamageProof(v, true) return end
setVehicleDamageProof(v,false)
end
end

addEventHandler ( "onVehicleEnter", root, function()
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end)

addEventHandler ( "onVehicleExit", root, function()
if (bezkierowcy(source)) then
setVehicleDamageProof(source, true)
else
if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
setVehicleDamageProof(source, false)
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-18, 10:00


GabWas







Wiek: 24
Na forum: 3881 dni
Posty: 289
Nick w MP: GabWas

Piwa: 65

Respekt: 231,5
Respekt: 231,5Respekt: 231,5

Wed?ug mnie wystarczy co? takiego:
addEventHandler("onVehicleExit"root,
function(plrs)
    if s==0 then
        setVehicleDamageProof(sourcetrue)
    end
end)

addEventHandler("onVehicleEnter"root,
function(plrs)
    if s==0 then
        setVehicleDamageProof(sourcefalse)
    end
end)

Ale je?eli ju? tak bardzo chcesz na elementDat?:
for _,v in pairs(getElementsByType("vehicle")) do
    if getElementData(v"damageproof")==1 then
        setVehicleDamageProof(sourcetrue)
    else
        setVehicleDamageProof(sourcefalse)
    end
end

addEventHandler("onVehicleExit"root,
function(plrs)
    if s==0 then
        setVehicleDamageProof(sourcetrue)
        setElementData(source"damageproof"1)
    end
end)

addEventHandler("onVehicleEnter"root,
function(plrs)
    if s==0 then
        setVehicleDamageProof(sourcefalse)
        setElementData(source"damageproof"0)
    end
end)


Ostatnio zmieniony przez GabWas 2016-07-18, 10:03, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-18, 10:13


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

Dalej nie dzia?a

Postaw piwo autorowi tego posta
 

 
Tagi: pojazdu
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