Wysłany: 2017-02-24, 15:58
Boleslaw2000
Leniwiec
Wiek: 26 Na forum: 3542 dni Posty: 39
Nick w MP: Boleslaw
Piwa : 22
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 oraz .
leftkey = ","
rightkey = "."
bothkey = "/"
LightState1 = { 0 }
LightState2 = { 0 }
BlinkT = {}
BlinkS = {}
function Blinker ( thePlayer , mode )
local vehicle = getPedOccupiedVehicle ( thePlayer )
if vehicle then
if BlinkT [ vehicle ] then
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 , b = getVehicleLightState ( vehicle , 0 ), getVehicleLightState ( vehicle , 1 )
LightState1 [ vehicle ] = a
LightState2 [ vehicle ] = b
if mode == leftkey then
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
if a == 0 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 1 , 0 , 3 )
elseif a == 1 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 2 , 0 , 3 )
end
elseif mode == rightkey then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
if b == 0 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 1 , 1 , 2 )
elseif b == 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 ( vehicle , l1 , 1 )
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 1 then
setVehicleLightState ( vehicle , l1 , 0 )
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 0 )
setVehicleLightState ( vehicle , 1 , 0 )
setVehicleLightState ( vehicle , 2 , 0 )
setVehicleLightState ( vehicle , 3 , 0 )
BlinkS [ vehicle ] = false
end
else
killTimer ( BlinkT [ vehicle ])
BlinkT [ vehicle ] = nil
end
end
end
addEventHandler ( "onVehicleEnter" , getRootElement (),
function( thePlayer )
bindKey ( thePlayer , leftkey , "down" , Blinker , thePlayer , leftkey )
bindKey ( thePlayer , rightkey , "down" , Blinker , thePlayer , rightkey )
bindKey ( thePlayer , bothkey , "down" , Blinker , thePlayer , bothkey )
end )
addEventHandler ( "onVehicleExit" , getRootElement (),
function( thePlayer )
unbindKey ( thePlayer , leftkey , "down" , Blinker )
unbindKey ( thePlayer , rightkey , "down" , Blinker )
unbindKey ( thePlayer , bothkey , "down" , Blinker )
end )
Wysłany: 2017-02-24, 16:01
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Podaj db3, chyba ?e tak to podmie? bindy - lewy na prawy i prawy na lewy
Podpis
"amited" napisał/a :
Wysłany: 2017-02-24, 16:04
Boleslaw2000
Leniwiec
Wiek: 26 Na forum: 3542 dni Posty: 39
Nick w MP: Boleslaw
Piwa : 22
"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.
Wysłany: 2017-02-24, 16:11
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
leftkey = ","
rightkey = "."
bothkey = "/"
LightState1 = { 0 }
LightState2 = { 0 }
BlinkT = {}
BlinkS = {}
function Blinker ( thePlayer , mode )
local vehicle = getPedOccupiedVehicle ( thePlayer )
if vehicle then
if BlinkT [ vehicle ] then
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 , b = getVehicleLightState ( vehicle , 0 ), getVehicleLightState ( vehicle , 1 )
LightState1 [ vehicle ] = a
LightState2 [ vehicle ] = b
if mode == leftkey then
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
if a == 0 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 1 , 0 , 3 )
elseif a == 1 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 2 , 0 , 3 )
end
elseif mode == rightkey then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
if b == 0 then
BlinkT [ vehicle ] = setTimer ( Blink , 250 , 0 , vehicle , 1 , 1 , 2 )
elseif b == 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 ( vehicle , l1 , 1 )
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 1 then
setVehicleLightState ( vehicle , l1 , 0 )
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 0 )
setVehicleLightState ( vehicle , 1 , 0 )
setVehicleLightState ( vehicle , 2 , 0 )
setVehicleLightState ( vehicle , 3 , 0 )
BlinkS [ vehicle ] = false
end
else
killTimer ( BlinkT [ vehicle ])
BlinkT [ vehicle ] = nil
end
end
end
addEventHandler ( "onVehicleEnter" , getRootElement (),
function( thePlayer )
bindKey ( thePlayer , leftkey , "down" , Blinker , thePlayer , leftkey )
bindKey ( thePlayer , rightkey , "down" , Blinker , thePlayer , rightkey )
bindKey ( thePlayer , bothkey , "down" , Blinker , thePlayer , bothkey )
end )
addEventHandler ( "onVehicleExit" , getRootElement (),
function( thePlayer )
unbindKey ( thePlayer , leftkey , "down" , Blinker )
unbindKey ( thePlayer , rightkey , "down" , Blinker )
unbindKey ( thePlayer , bothkey , "down" , Blinker )
end )
Zobacz tak
Podpis
"amited" napisał/a :
Wysłany: 2017-02-24, 16:16
Boleslaw2000
Leniwiec
Wiek: 26 Na forum: 3542 dni Posty: 39
Nick w MP: Boleslaw
Piwa : 22
amited , dzia?aj? tak samo jak dzia?a?y.
Wysłany: 2017-02-24, 16:20
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
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:
Podpis
"amited" napisał/a :
Wysłany: 2017-02-24, 16:25
Boleslaw2000
Leniwiec
Wiek: 26 Na forum: 3542 dni Posty: 39
Nick w MP: Boleslaw
Piwa : 22
amited , kierowa?em si? tym w?a?nie, ustawia?em tak i tak - nic.
Wysłany: 2017-02-24, 16:33
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
leftkey = ","
rightkey = "."
bothkey = "/"
LightState1 = { 0 }
LightState2 = { 0 }
BlinkT = {}
BlinkS = {}
function Blinker ( thePlayer , mode )
local vehicle = getPedOccupiedVehicle ( thePlayer )
if vehicle then
if BlinkT [ vehicle ] then
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 , b = getVehicleLightState ( vehicle , 0 ), getVehicleLightState ( vehicle , 1 )
LightState1 [ vehicle ] = a
LightState2 [ vehicle ] = b
if mode == leftkey then
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
elseif mode == rightkey then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
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 ( vehicle , l1 , 1 )
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 1 then
setVehicleLightState ( vehicle , l1 , 0 )
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 0 )
setVehicleLightState ( vehicle , 1 , 0 )
setVehicleLightState ( vehicle , 2 , 0 )
setVehicleLightState ( vehicle , 3 , 0 )
BlinkS [ vehicle ] = false
end
else
killTimer ( BlinkT [ vehicle ])
BlinkT [ vehicle ] = nil
end
end
end
addEventHandler ( "onVehicleEnter" , getRootElement (),
function( thePlayer )
bindKey ( thePlayer , leftkey , "down" , Blinker , thePlayer , leftkey )
bindKey ( thePlayer , rightkey , "down" , Blinker , thePlayer , rightkey )
bindKey ( thePlayer , bothkey , "down" , Blinker , thePlayer , bothkey )
end )
addEventHandler ( "onVehicleExit" , getRootElement (),
function( thePlayer )
unbindKey ( thePlayer , leftkey , "down" , Blinker )
unbindKey ( thePlayer , rightkey , "down" , Blinker )
unbindKey ( thePlayer , bothkey , "down" , Blinker )
end )
a tak zobacz
Podpis
"amited" napisał/a :
Wysłany: 2017-02-24, 17:59
Boleslaw2000
Leniwiec
Wiek: 26 Na forum: 3542 dni Posty: 39
Nick w MP: Boleslaw
Piwa : 22
amited , tak w og?le nie dzia?aj?.
Wysłany: 2017-02-24, 18:33
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
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 ( vehicle , l1 , 1 )
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 1 then
setVehicleLightState ( vehicle , l1 , 0 )
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 2 then
setVehicleLightState ( vehicle , l2 , 0 )
BlinkS [ vehicle ] = false
elseif not BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 1 )
setVehicleLightState ( vehicle , 1 , 1 )
setVehicleLightState ( vehicle , 2 , 1 )
setVehicleLightState ( vehicle , 3 , 1 )
BlinkS [ vehicle ] = true
elseif BlinkS [ vehicle ] and how == 3 then
setVehicleLightState ( vehicle , 0 , 0 )
setVehicleLightState ( vehicle , 1 , 0 )
setVehicleLightState ( vehicle , 2 , 0 )
setVehicleLightState ( vehicle , 3 , 0 )
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 :
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
amited , okej. B?d? kmini?. Dzi?ki za og?ln? pomoc.
Tagi: ustawienia :: kierunkowskazów
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: