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

Wysłany: 2016-01-18, 20:41


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90

Witam chcia?bym na spawnie zrobi? darmowe skutery kt?re resetuj? si? 5 minut od momentu zej?cia z niego + ?eby si? nie resetowa? gdy jest na spawnie.

Kod kt?ry mam jednak on nie jest optymalny bo jak np pojad? i zejd? to on mo?e od razu znikn??:


setTimer(function()
if not getVehicleController(spawn1then
destroyElement(spawn1)

spawn1 createVehicle 462, -1987.7902.7999944.9180174.50677490234"Axel")
setVehicleColorspawn12552552552550)
end
end60*10000)



Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-18, 20:53


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%

skurety = {
{x,y,z},
{x,y,z},
{x,y,z},
{x,y,z}
}
cuboid = 

for k,v in ipairs (skutery) do
createVehicle(.....)

end

addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
end
end


function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end


Co? takiego powinno dzia?a?.

Aa no i jeszcze do tego uzupe?nij niekt?re fragmenty.

Ostatnio zmieniony przez #404 2016-01-18, 21:05, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-18, 21:03


venzikk

LUA, MODELER






Wiek: 24
Na forum: 3823 dni
Posty: 235
Nick w MP: VenZ

Piwa: 3158

Respekt: 240
Respekt: 240Respekt: 240

Powinno dzia?a?



local pojazdyPub = {
    {462x,y,z}, 
    {462x,y,z},
    {462x,y,z},
    {462x,y,z},
    {462x,y,z}
}

for i,v in ipairs(pojazdyPub) do
    local pojazd createVehicle(v[1], v[2], v[3], v[4], v[5])
    setElementData(pojazd"opis""Pojazd publiczny")
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
        setElementData(source"opis""")
    end
end)


function respawnVehicles()
    for i,v in ipairs(getElementsByType("vehicle"resourceRoot)) do
        if not getVehicleOccupant(vthen
            respawnVehicle(v)
            setElementFrozen(vtrue)
            setElementData(v"opis""Pojazd publiczny")
        end
    end
end
setTimer(respawnVehicles500000)


Podpis



Hej
,Tak ty! Pomogłem ci? zostaw
:piwo:


Pomagam w miarę możliwości :)

Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 00:19


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90

Mam kod :

local pojazdyPub = {
    {462, -1987.7902.7999944.9}, 
    {462, -1986.5902.7999944.9},
    {462, -1985.3902.7000144.9},
    {462, -1984.1902.7999944.9},
    {462, -1982.9902.5996144.9},
    {462, -1981.7002902.7000144.9},
    {462, -1987.5865.7000144.9},
    {462, -1986.4004865.700244.9},
    {462, -1985.4865.5999844.9},
    {462, -1984.4865.5999844.9},
    {462, -1983.2998865.544.9},
    {462, -1982.2865.544.9}
}

for i,v in ipairs(pojazdyPub) do
    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5])
    setElementData(pojazd"message","Pojazd Publiczny")
    setVehicleColor(pojazd2552552550160255)
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
    end
end)


addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
--if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
setElementFrozen(pojazdtrue)
end
end


Tak wiem to s? 2 w 1 ale teraz np wywali?o mi b??d:

38attempt to call global 'isVehicleEmpty' (a nil value)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 01:52


Novovix

xNinja powraca






Wiek: 26
Na forum: 4870 dni
Posty: 240
Nick w MP: xNinja

Piwa: 452

Respekt: 80,5

Nie wklei?e? funkcji "isVehicleEmpty":
function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 13:08


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90

Dobra mam tak.

cuboid createColCuboid(-1995.8308859.5613431.29687588.549.522.25)
local pojazdyPub = {
    {462, -1987.7902.7999944.9}, 
    {462, -1986.5902.7999944.9},
    {462, -1985.3902.7000144.9},
    {462, -1984.1902.7999944.9},
    {462, -1982.9902.5996144.9},
    {462, -1981.7002902.7000144.9},
    {462, -1987.5865.7000144.9},
    {462, -1986.4004865.700244.9},
    {462, -1985.4865.5999844.9},
    {462, -1984.4865.5999844.9},
    {462, -1983.2998865.544.9},
    {462, -1982.2865.544.9}
}

for i,v in ipairs(pojazdyPub) do
    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5])
    setElementData(pojazd"message","Pojazd Publiczny")
    setVehicleColor(pojazd2552552550160255)
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
    end
end)


addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
setElementFrozen(pojazdtrue)
end
end

function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end


Jest b??d:

s.lua:40attempt to call global 'respawnElement' (a nil value)


I chcia?bym doda? aby pierwsze 6 aut by?o odwr?cone o 180stopni :



 {462, -1987.7902.7999944.9}, 
    {462, -1986.5902.7999944.9},
    {462, -1985.3902.7000144.9},
    {462, -1984.1902.7999944.9},
    {462, -1982.9902.5996144.9},
    {462, -1981.7002902.7000144.9},



Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 14:08


venzikk

LUA, MODELER






Wiek: 24
Na forum: 3823 dni
Posty: 235
Nick w MP: VenZ

Piwa: 3158

Respekt: 240
Respekt: 240Respekt: 240

je?eli chcesz aby by?y obr?cone o 180 to dodaj do tych pierwszy sze?ciu
I tak w ka?dym te ostatnie 0, 0, 180 ;)

np.

 {462, -1987.7902.7999944.900180},


tam zamiast

    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5])


    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[7], v[8], v[9], v[10], v[11])


[ Dodano: 2016-01-19, 14:14 ]
cuboid createColCuboid(-1995.8308859.5613431.29687588.549.522.25)
local pojazdyPub = {
    {462, -1987.7902.7999944.900180}, 
    {462, -1986.5902.7999944.900180},
    {462, -1985.3902.7000144.900180},
    {462, -1984.1902.7999944.900180},
    {462, -1982.9902.5996144.900180},
    {462, -1981.7002902.7000144.900180},
    {462, -1987.5865.7000144.9},
    {462, -1986.4004865.700244.9},
    {462, -1985.4865.5999844.9},
    {462, -1984.4865.5999844.9},
    {462, -1983.2998865.544.9},
    {462, -1982.2865.544.9}
}


for i,v in ipairs(pojazdyPub) do
    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[7], v[8], v[9], v[10], v[11])
    setElementData(pojazd"message","Pojazd Publiczny")
    setVehicleColor(pojazd2552552550160255)
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
    end
end)


addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
setElementFrozen(pojazdtrue)
end
end

function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end



powinno dzia?a? :D

Podpis



Hej
,Tak ty! Pomogłem ci? zostaw
:piwo:


Pomagam w miarę możliwości :)

Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 14:16


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90

Okej Rotacja dzia?a teraz tylko nie respi auta :


cuboid createColCuboid(-1995.8308859.5613431.29687588.549.522.25)
local pojazdyPub = {
    {462, -1987.7902.7999944.900180}, 
    {462, -1986.5902.7999944.900180},
    {462, -1985.3902.7000144.900180},
    {462, -1984.1902.7999944.900180},
    {462, -1982.9902.5996144.900180},
    {462, -1981.7002902.7000144.900180},
    {462, -1987.5865.7000144.9},
    {462, -1986.4004865.700244.9},
    {462, -1985.4865.5999844.9},
    {462, -1984.4865.5999844.9},
    {462, -1983.2998865.544.9},
    {462, -1982.2865.544.9}
}

for i,v in ipairs(pojazdyPub) do
    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[7], v[8], v[9], v[10], v[11], v[12])
    setElementData(pojazd"message","Pojazd Publiczny")
    setVehicleColor(pojazd2552552550160255)
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
    end
end)


addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
setElementFrozen(pojazdtrue)
end
end

function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end




B??d:


s.lua:40attempt to call global 'respawnElement' (a nil value)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 14:25


venzikk

LUA, MODELER






Wiek: 24
Na forum: 3823 dni
Posty: 235
Nick w MP: VenZ

Piwa: 3158

Respekt: 240
Respekt: 240Respekt: 240

Spr?buj teraz ;D


cuboid createColCuboid(-1995.8308859.5613431.29687588.549.522.25)
local pojazd = {
    {462, -1987.7902.7999944.900180}, 
    {462, -1986.5902.7999944.900180},
    {462, -1985.3902.7000144.900180},
    {462, -1984.1902.7999944.900180},
    {462, -1982.9902.5996144.900180},
    {462, -1981.7002902.7000144.900180},
    {462, -1987.5865.7000144.9},
    {462, -1986.4004865.700244.9},
    {462, -1985.4865.5999844.9},
    {462, -1984.4865.5999844.9},
    {462, -1983.2998865.544.9},
    {462, -1982.2865.544.9}
}

for i,v in ipairs(pojazd) do
    pojazd createVehicle(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[7], v[8], v[9], v[10], v[11], v[12])
    setElementData(pojazd"message","Pojazd Publiczny")
    setVehicleColor(pojazd2552552550160255)
    setElementFrozen(pojazdtrue)
end

addEventHandler("onVehicleEnter"resourceRoot, function(plrseat)
    if seat == 0 then
        setElementFrozen(sourcefalse)
    end
end)


addEventHandler("onVehicleExit"resourceRoot, function()
setTimer(usun1000*60*51source)
end
)

function usun (pojazd)
if not pojazd then return end
if isElementWithinColShape(pojazdcuboidthen return end
if isVehicleEmpty(pojazdthen
respawnElement(pojazd)
setElementFrozen(pojazdtrue)
end
end

function isVehicleEmptyvehicle )
    if not isElementvehicle ) or getElementTypevehicle ) ~= "vehicle" then
        return true
    end
 
    local passengers getVehicleMaxPassengersvehicle )
    if typepassengers ) == 'number' then
        for seat 0passengers do
            if getVehicleOccupantvehicleseat then
                return false
            end
        end
    end
    return true
end



Podpis



Hej
,Tak ty! Pomogłem ci? zostaw
:piwo:


Pomagam w miarę możliwości :)

Kontakt:
Discord: VenZio#8080
GG:63293490
skype:szymex1021
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 14:29


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Zamiast createVehicle([1][2][3]) itd... Mo?esz zrobi? tak:


for i,v in ipairs(pojazd) do
    pojazd createVehicle(unpack(v))


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 15:01


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90


s.lua:40attempt to call global 'respawnElement' (a nil value)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 15:07


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Wybacz, to ja rozpocz??em t? fal? error?w, pisa?em na szybko i popapra?em funkcj?, prawid?owa to


Więcej informacji znajdziesz w Wikipedii MTA:

respawnVehicle
a nie element xD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-19, 15:22


Daisu

Programista Lua






Wiek: 26
Na forum: 4444 dni
Posty: 193
SPONSOR
Nick w MP: Daisu

Piwa: 24

Respekt: 90

DestroY Wygra? teleturniej error?w. Dzi?ki ka?demu za pomoc skrypt dzia?a w 100% :D

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: darmowe :: auta :: (timer)
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Darmowe Auta (Timer) 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