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

Wysłany: 2017-03-01, 15:40


LukaSz11







Wiek: 38
Na forum: 5677 dni
Posty: 11
Nick w MP: Luki



Respekt: 50

Witam, mam pro?b? czy m?g?by mi kto? przekszta?ci? ten ma?y skrypcik tak, ?eby pojazdy automatycznie respawnowa?y si? co 30 sekund zamiast u?ycia komendy? Oraz, ?eby nie by?o ?adnych powiadomie?, ?e ta czynno?? b?dzie/lub jest wykonywana (takie odchudzenie :P ). Z g?ry dzi?ki, pozdrawiam :)

local respawn 30
local r

addCommandHandler("rav",function(player)
    if isTimer(rthen
        resetTimer(r)
        outputDebugString("Timer Reset")
        return
    end
    outputChatBox("RESPAWNING ALL UNOCCUPIED VEHICLES IN ".. respawn.."SECONDS")
    outputDebugString("Cars Respawning")
    setTimer(function()
        for _vehicle in ipairs getElementsByType "vehicle" ) ) do -- For every vehicle do the following...
            if isEmptyvehicle then
                resetVehicleIdleTime vehicle ) -- Reset the vehicle's idle time
                respawnVehicle ( vehicle )
            end
        end    
        outputDebugString("Cars Respawned")
        outputChatBox("ALL UNOCCUPIED VEHICLES RESPAWNED")
    end,respawn*1000,1)
end)

function isEmpty( vehicle )
    local passengers = getVehicleMaxPassengers( vehicle )
    if type( passengers ) == 'number' then
        for seat = 0, passengers do
            if getVehicleOccupant( vehicle, seat ) then
                return false
            end
        end
    end
    return true
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-01, 15:56


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466



function startt()
setTimer(
        for _vehicle in ipairs getElementsByType "vehicle" ) ) do
            if isEmptyvehicle then
                resetVehicleIdleTime vehicle )
                respawnVehicle vehicle )
            end  
end,30000,0)
end

function isEmptyvehicle )
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number then
        for seat = 0, passengers do
            if getVehicleOccupant( vehicle, seat ) then
                return false
            end
        end
    end
    return true
end

addEventHandler("onResourceStart", getRootElement(),startt)

Je?eli nie dzia?a to daj db3

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: respawn :: drobna :: modyfikacja.
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