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

Wysłany: 2015-07-09, 19:49


sebik2303

Mapper :)






Wiek: 25
Na forum: 4160 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Witam, czemu w interakcji pojazdu Splita nie mog? zgasi? pojazdu, oraz gdy nie mam paliwa mog? je?dzi? ? Prosz? o pomoc :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 20:21


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

A moze tak kod dasz? : )

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 20:48


sebik2303

Mapper :)






Wiek: 25
Na forum: 4160 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

No wi?c:

--[[
    @author Split <yourworld.pl>
    @copyright 2011-2013 Split
    Wszelkie prawa zastrze?one.
]]--

isBike = {[509]=true, [481]=true, [510]=true} -- rowery

addEvent("onChooseInteractionV1"true)
addEventHandler("onChooseInteractionV1"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
        local engine getVehicleEngineState(vehicle)
        if engine == false then
            setVehicleEngineStatevehicletrue)
            outputChatBox("* Uruchomi?e? silnik."source)
        else
            if getElementData(vehicle"pojazd_paliwo") == 0 then
                outputChatBox("* Nie mo?na odpali? silnika, brak paliwa."plr)
                return
            end
            if getElementData(vehicle"vehicle_mileage") == 10000 then
                outputChatBox("* Nie mo?na odpali? silnika, zbyt du?y przebieg."plr)
                return
            end
            setVehicleEngineStatevehiclefalse)
            outputChatBox("* Zgasi?e? silnik."source)
        end
    end
end)

addEvent("onChooseInteractionV2"true)
addEventHandler("onChooseInteractionV2"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
        if getVehicleOverrideLights(vehicle) ~= 2 then
            setVehicleOverrideLights(vehicle2)
            outputChatBox("* Zapali?e? ?wiat?a"source)
        else
            setVehicleOverrideLights(vehicle1)
            outputChatBox("* Zgasi?e? ?wiat?a."source)
        end
    end
end)

addEvent("onChooseInteractionV3"true)
addEventHandler("onChooseInteractionV3"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
        outputChatBox("* Zamykanie pojazdu w budowie"source)
    end
end)

addEvent("onChooseInteractionV4"true)
addEventHandler("onChooseInteractionV4"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        --if not getElementData(vehicle"pojazd_zrespiony"then return end
        if isBike[getElementModel(vehicle)] then return end
        local sx,sy,sz getElementVelocity(vehicle)
        local aspeed = (sx^sy^sz^2)^(0.5)
        local kmh aspeed 180
        if kmh 2 then
            if isElementFrozen(vehiclethen
                setElementFrozen(vehiclefalse)
                outputChatBox("* Spu?ci?e? r?czny."source)
            else
                setElementFrozen(vehicletrue)
                outputChatBox("* Zaci?gn??e? r?czny."source)
            end
        end
    end
end)

to jest interakcja, a paliwo:

local czas getTickCount()

isBike = {
    [509]=true, --Bike
    [481]=true, --BMX
    [510]=true, --Mountain bike
}

function odejmijPaliwo(pojazd)
    if getTickCount() - czas 150 then
        czas getTickCount()
        local paliwo getElementData(pojazd"pojazd_paliwo") or 0
        local vx,vy,vz getElementVelocity(pojazd)
        local spd = ((vx^2+vy^2+vz^2)^(0.5)/150)
        if spd 0 then
            paliwo paliwo-spd*2
            setElementData(pojazd"pojazd_paliwo"paliwo)
        end
    end
end

addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if isBike[getElementModel(pojazd)] then return end
    if not getVehicleEngineState(pojazdthen return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    odejmijPaliwo(pojazd)
end)

function zgasSilnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local data getElementData(v"pojazd_paliwo")
        if data then
        if tonumber(data) < 0 then
            setVehicleEngineState(vfalse)
        end
end
    end
end
setTimer(zgasSilnik1000999999999


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 20:58


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3


local czas getTickCount()

isBike = {
    [509]=true, --Bike
    [481]=true, --BMX
    [510]=true, --Mountain bike
}

function odejmijPaliwo(pojazd)
    if getTickCount() - czas 150 then
        czas getTickCount()
        local paliwo getElementData(pojazd"pojazd_paliwo") or 0
        local vx,vy,vz getElementVelocity(pojazd)
        local spd = ((vx^2+vy^2+vz^2)^(0.5)/150)
        if spd 0 then
            paliwo paliwo-spd*2
            setElementData(pojazd"pojazd_paliwo"paliwo)
        end
    end
end

addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if isBike[getElementModel(pojazd)] then return end
    if not getVehicleEngineState(pojazdthen return end
    if getVehicleController(pojazd) ~= localPlayer then return end
    odejmijPaliwo(pojazd)
end)

function zgasSilnik()
    for i,v in ipairs(getElementsByType("vehicle")) do
    local data getElementData(v"pojazd_paliwo")
        if data then
        if tonumber(data) <= 0 then
            setVehicleEngineState(vfalse)
        end
end
    end
end
setTimer(zgasSilnik1000999999999


Tutaj masz paliwo, teraz powinno dzialac.

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 21:01


sebik2303

Mapper :)






Wiek: 25
Na forum: 4160 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Iksdekowski, nadal nie dzia?a :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 21:19


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3


--[[
    @author Split <yourworld.pl>
    @copyright 2011-2013 Split
    Wszelkie prawa zastrze?one.
]]--

isBike = {[509]=true, [481]=true, [510]=true} -- rowery

addEvent("onChooseInteractionV1"true)
addEventHandler("onChooseInteractionV1"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
            if getElementData(vehicle"pojazd_paliwo") == 0 then
                outputChatBox("* Nie mo?na odpali? silnika, brak paliwa."plr)
                return
            end
            if getElementData(vehicle"vehicle_mileage") == 10000 then
                outputChatBox("* Nie mo?na odpali? silnika, zbyt du?y przebieg."plr)
                return
            end
        local engine getVehicleEngineState(vehicle)
        if engine == false then
            setVehicleEngineStatevehicletrue)
            outputChatBox("* Uruchomi?e? silnik."source)
        else
            setVehicleEngineStatevehiclefalse)
            outputChatBox("* Zgasi?e? silnik."source)
        end
    end
end)

addEvent("onChooseInteractionV2"true)
addEventHandler("onChooseInteractionV2"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
        if getVehicleOverrideLights(vehicle) ~= 2 then
            setVehicleOverrideLights(vehicle2)
            outputChatBox("* Zapali?e? ?wiat?a"source)
        else
            setVehicleOverrideLights(vehicle1)
            outputChatBox("* Zgasi?e? ?wiat?a."source)
        end
    end
end)

addEvent("onChooseInteractionV3"true)
addEventHandler("onChooseInteractionV3"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        if isBike[getElementModel(vehicle)] then return end
        outputChatBox("* Zamykanie pojazdu w budowie"source)
    end
end)

addEvent("onChooseInteractionV4"true)
addEventHandler("onChooseInteractionV4"root, function()
    local vehicle getPedOccupiedVehicle(source)
    if vehicle then
        --if not getElementData(vehicle"pojazd_zrespiony"then return end
        if isBike[getElementModel(vehicle)] then return end
        local sx,sy,sz getElementVelocity(vehicle)
        local aspeed = (sx^sy^sz^2)^(0.5)
        local kmh aspeed 180
        if kmh 2 then
            if isElementFrozen(vehiclethen
                setElementFrozen(vehiclefalse)
                outputChatBox("* Spu?ci?e? r?czny."source)
            else
                setElementFrozen(vehicletrue)
                outputChatBox("* Zaci?gn??e? r?czny."source)
            end
        end
    end
end)



To jest ten kod od interakcji, sprobuj.

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 21:28


sebik2303

Mapper :)






Wiek: 25
Na forum: 4160 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

nie dzia?a czemu ?! :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 21:30


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

a jakie? db3 s??

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-09, 21:41


sebik2303

Mapper :)






Wiek: 25
Na forum: 4160 dni
Posty: 298
Nick w MP: sebik2303

Piwa: 899

Respekt: 55,3

Nie ma

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-20, 08:34


adamek21







Wiek: 34
Na forum: 3984 dni
Posty: 1



Respekt: 50

Mi dzia?a

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-07-20, 18:38


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Dopisz to do paliwa:

Kod:

function brakpaliwa()
veh = getPedOccupiedVehicle(localPlayer)
if veh and (not getElementData(veh,"pojazd_paliwo") == false ) and getElementData(veh,"pojazd_paliwo") <= 0 then
setElementData(veh,"pojazd_paliwo",0)
setVehicleEngineState(veh,false)
end
end
addEventHandler("onClientRender",root,brakpaliwa)


U mnie dzia?a.

Postaw piwo autorowi tego posta
 

 
Tagi: interakcja :: oraz :: paliwo
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