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

Wysłany: 2017-02-24, 15:58


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

Hej ponownie, mam problem, ot?? chc?, aby przy tych kierunkowskazach by?y w??czone lampy, np. gdy w??czamy prawy kierunkowskaz, prawa lampa miga, a lewa si? ?wieci - i na odwr?t. Pr?bowa?em ustawia? w tych cyferkach.. Ale nie przynosi?o to efekt?w, zazwyczaj psu?em kod. Za pomoc oczywi?cie :piwo: oraz R* .


leftkey ","
rightkey "."
bothkey "/"

LightState1 = {0}
LightState2 = {0}

BlinkT = {}
BlinkS = {}

function Blinker(thePlayer,mode)
    local vehicle getPedOccupiedVehicle(thePlayer)
        if vehicle then
            if BlinkT[vehiclethen
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
                setVehicleLightState(vehicle,0,LightState1[vehicle])
                setVehicleLightState(vehicle,1,LightState2[vehicle])
                setVehicleLightState(vehicle,3,0)
                setVehicleLightState(vehicle,2,0)
                setVehicleOverrideLights(vehicle,0)
            else
                setVehicleOverrideLights(vehicle,2)
                setElementData(vehicle,"asd","asd")
                
                local a,getVehicleLightState(vehicle,0),getVehicleLightState(vehicle,1)
                LightState1[vehicle] = a
                LightState2[vehicle] = b
                
                if mode == leftkey then
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    if == 0 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,1,0,3)
                    elseif == 1 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,2,0,3)
                    end
                elseif mode == rightkey then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle3)
                    if == 0 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,1,1,2)
                    elseif == 1 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,2,1,2)
                    end
                elseif mode == bothkey then
                        BlinkT[vehicle] = setTimer(Blink,200,0,vehicle,3,0,1)
                end
            end
        end
    end

function Blink(vehicle,how,l1,l2)
        if vehicle then
            if getElementData(vehicle,"asd"then
                if not BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = false
                end
            else
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
        end
    end
end

addEventHandler "onVehicleEnter"getRootElement(),
function(thePlayer)
    bindKey thePlayerleftkey"down"BlinkerthePlayerleftkey)
    bindKey thePlayerrightkey"down"BlinkerthePlayerrightkey)
    bindKey thePlayerbothkey"down"BlinkerthePlayerbothkey)
end)

addEventHandler "onVehicleExit"getRootElement(),
function(thePlayer)
    unbindKey thePlayerleftkey"down"Blinker)
    unbindKey thePlayerrightkey"down"Blinker)
    unbindKey thePlayerbothkey"down"Blinker)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 16:01


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

Podaj db3, chyba ?e tak to podmie? bindy - lewy na prawy i prawy na lewy ;)

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

 
Wysłany: 2017-02-24, 16:04


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

"amited" napisał/a:

Podaj db3, chyba ?e tak to podmie? bindy

Nie chodzi tutaj o problem, tylko o pomoc. Zwyczajnie jest tak, ?e przy w??czeniu prawego kierunkowskazu prawy miga, a lewa lampa si? wy??cza - i to jest okej, domy?lny kod, lecz ja chc? zrobi? tak, by przy w??czeniu np. kierunkowskazu lewego lewy miga? a prawa lampa by?a wci?? w??czona. I na odwr?t.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 16:11


amited







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

Piwa: 512

Respekt: 466
Respekt: 466


leftkey ","
rightkey "."
bothkey "/"

LightState1 = {0}
LightState2 = {0}

BlinkT = {}
BlinkS = {}

function Blinker(thePlayer,mode)
    local vehicle getPedOccupiedVehicle(thePlayer)
        if vehicle then
            if BlinkT[vehiclethen
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
                setVehicleLightState(vehicle,0,LightState1[vehicle])
                setVehicleLightState(vehicle,1,LightState2[vehicle])
                setVehicleLightState(vehicle,3,0)
                setVehicleLightState(vehicle,2,0)
                setVehicleOverrideLights(vehicle,2)
            else
                setVehicleOverrideLights(vehicle,2)
                setElementData(vehicle,"asd","asd")
                
                local a,getVehicleLightState(vehicle,0),getVehicleLightState(vehicle,1)
                LightState1[vehicle] = a
                LightState2[vehicle] = b
                
                if mode == leftkey then
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    if == 0 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,1,0,3)
                    elseif == 1 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,2,0,3)
                    end
                elseif mode == rightkey then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle3)
                    if == 0 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,1,1,2)
                    elseif == 1 then
                        BlinkT[vehicle] = setTimer(Blink,250,0,vehicle,2,1,2)
                    end
                elseif mode == bothkey then
                        BlinkT[vehicle] = setTimer(Blink,200,0,vehicle,3,0,1)
                end
            end
        end
    end

function Blink(vehicle,how,l1,l2)
        if vehicle then
            if getElementData(vehicle,"asd"then
                if not BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = false
                end
            else
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
        end
    end
end

addEventHandler "onVehicleEnter"getRootElement(),
function(thePlayer)
    bindKey thePlayerleftkey"down"BlinkerthePlayerleftkey)
    bindKey thePlayerrightkey"down"BlinkerthePlayerrightkey)
    bindKey thePlayerbothkey"down"BlinkerthePlayerbothkey)
end)

addEventHandler "onVehicleExit"getRootElement(),
function(thePlayer)
    unbindKey thePlayerleftkey"down"Blinker)
    unbindKey thePlayerrightkey"down"Blinker)
    unbindKey thePlayerbothkey"down"Blinker)
end)

Zobacz tak

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

 
Wysłany: 2017-02-24, 16:16


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

amited, dzia?aj? tak samo jak dzia?a?y.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 16:20


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

Hmm nie wiem,

                setVehicleOverrideLights(vehicle,2)
            else
                setVehicleOverrideLights(vehicle,2)

Te linijki odpowiadaj? za ?wiat?a czy maj? by? w??czone czy wy??czone. We? tam daj 0 albo 2 bo 1 wy??cza ?wiat?a. Wi?cej masz tutaj:

Więcej informacji znajdziesz w Wikipedii MTA:

SetVehicleOverrideLights


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

 
Wysłany: 2017-02-24, 16:25


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

amited, kierowa?em si? tym w?a?nie, ustawia?em tak i tak - nic. :evil:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 16:33


amited







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

Piwa: 512

Respekt: 466
Respekt: 466


leftkey ","
rightkey "."
bothkey "/"

LightState1 = {0}
LightState2 = {0}

BlinkT = {}
BlinkS = {}

function Blinker(thePlayer,mode)
    local vehicle getPedOccupiedVehicle(thePlayer)
        if vehicle then
            if BlinkT[vehiclethen
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
                setVehicleLightState(vehicle,0,LightState1[vehicle])
                setVehicleLightState(vehicle,1,LightState2[vehicle])
                setVehicleLightState(vehicle,3,0)
                setVehicleLightState(vehicle,2,0)
                setVehicleOverrideLights(vehicle,0)
            else
                setVehicleOverrideLights(vehicle,2)
                setElementData(vehicle,"asd","asd")
                
                local a,getVehicleLightState(vehicle,0),getVehicleLightState(vehicle,1)
                LightState1[vehicle] = a
                LightState2[vehicle] = b
                
                if mode == leftkey then
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                elseif mode == rightkey then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle3)
                elseif mode == bothkey then
                        BlinkT[vehicle] = setTimer(Blink,200,0,vehicle,3,0,1)
                end
            end
        end
    end

function Blink(vehicle,how,l1,l2)
        if vehicle then
            if getElementData(vehicle,"asd"then
                if not BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = false
                end
            else
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
        end
    end
end

addEventHandler "onVehicleEnter"getRootElement(),
function(thePlayer)
    bindKey thePlayerleftkey"down"BlinkerthePlayerleftkey)
    bindKey thePlayerrightkey"down"BlinkerthePlayerrightkey)
    bindKey thePlayerbothkey"down"BlinkerthePlayerbothkey)
end)

addEventHandler "onVehicleExit"getRootElement(),
function(thePlayer)
    unbindKey thePlayerleftkey"down"Blinker)
    unbindKey thePlayerrightkey"down"Blinker)
    unbindKey thePlayerbothkey"down"Blinker)
end)

a tak zobacz

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

 
Wysłany: 2017-02-24, 17:59


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

amited, tak w og?le nie dzia?aj?. :-?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 18:33


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

Dobra we? ten pocz?tkowy sw?j kod i jedyne co zmieniaj to rzeczy w tej funkcji:

function Blink(vehicle,how,l1,l2)
        if vehicle then
            if getElementData(vehicle,"asd"then
                if not BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 1 then
                    setVehicleLightState vehiclel1)
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 2 then
                    setVehicleLightState vehiclel2)
                    BlinkS[vehicle] = false
                elseif not BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = true
                elseif BlinkS[vehicle] and how == 3 then
                    setVehicleLightState vehicle0)
                    setVehicleLightState vehicle1)
                    setVehicleLightState vehicle2)
                    setVehicleLightState vehicle3)
                    BlinkS[vehicle] = false
                end
            else
                killTimer(BlinkT[vehicle])
                BlinkT[vehicle] = nil
        end
    end
end

zmieniaj liczby na 0/1 i mo?e b?dzie dzia?a? a jak nie to nie wiem xd bo to " setVehicleOverrideLights" odpowiada za ON/OFF ?wiate?

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

 
Więcej szczegółów
Wystawiono 1 piw(a):
Boleslaw2000
Wysłany: 2017-02-24, 18:39


Boleslaw2000

Leniwiec






Wiek: 26
Na forum: 3542 dni
Posty: 39
Nick w MP: Boleslaw

Piwa: 22

Respekt: 50

amited, okej. B?d? kmini?. Dzi?ki za og?ln? pomoc. ;)

Postaw piwo autorowi tego posta
 

 
Tagi: ustawienia :: kierunkowskazów
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Ustawienia kierunkowskazów 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