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

Wysłany: 2017-04-05, 17:43


Krzemo1234







Wiek: 27
Na forum: 3892 dni
Posty: 387
Nick w MP: Krzemo

Piwa: 16

Respekt: 40

Witam mam skrypt na to ,?e jak nikogo nie ma w poj?dzie auto si? nie rozwala
i co? mi nie dzia??

local function pojazdPusty(veh)
if not veh then return end
    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") and getPedOccupiedVehicleSeat(occupant) == i then
        return false
    end
    end
    return true
end


for i,v in ipairs(getElementsByType("vehicle")) do
    if (pojazdPusty(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 source then
    if getElementData(source,"damageproof") then setVehicleDamageProof(source, true) return end
    setVehicleDamageProof(source, false)
    end
end)

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-05, 17:52


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

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


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Tagi: rozwalanie :: auta :: bez :: kierowcy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Rozwalanie auta bez kierowcy 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