Wysłany: 2020-03-16, 19:45
QjubS
Wiek: 27 Na forum: 2300 dni Posty: 2
Nick w MP: QjubS
Cze??, mam skrypt na otwieranie szlabanu za pomoc? przycisku i mam taki problem, ?e przycisk nie dzia?a w aucie macie mo?e jaki? pomys? co by tu zmieni?, ?eby wszystko dzia?a?o jak nale?y?
bra1 = createObject ( 968 , 1409.7998046875 ,- 1862.099609375 , 13.39999961853 , 0 , 90 , 0 )
mar1 = createMarker ( 1413.3000488281 , - 1862.4000244141 , 12.300000190735 , 'cylinder' , 10.0 , 0 , 0 , 255 , 0 )
function wyliczProcent1 ( czas , czas_ruchu )
local czas_aktualny = getTickCount ( ) - czas
return math . min ( czas_aktualny / czas_ruchu , 1 )
end
openclose = true
function MarkerHit1 ( hitPlayer , matchingDimension )
local jestOtwarty = getElementData ( bra1 , "otwary" )
local x , y , z = getElementPosition ( bra1 )
local czas = getElementData ( bra1 , "uruchomiony" ) or 0
local procent = wyliczProcent1 ( czas , 1000 )
local playera = hitPlayer
if isElementWithinMarker ( playera , mar1 ) then
if getElementType ( playera ) == "player" then
if isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( playera ) ), aclGetGroup ( 'Urzad' ) ) then
if jestOtwarty then
openclose = false
moveObject ( bra1 , 1000 * procent , x , y , z , 0 , 90 * procent , 0 )
else
openclose = true
moveObject ( bra1 , 1000 * procent , x , y , z , 0 , - 90 * procent , 0 )
end
end
setElementData ( bra1 , "otwary" , not jestOtwarty )
local tick = getTickCount ( ) - 1000 *( 1 - procent )
setElementData ( bra1 , "uruchomiony" , tick )
end
end
end
addEventHandler ( "onPlayerJoin" , root , function()
for k , v in ipairs ( getElementsByType ( "player" )) do
function Creation1 ( el , md )
bindKey ( v , "space" , "down" , MarkerHit1 )
end
addEventHandler ( "onMarkerHit" , mar1 , Creation1 )
function Delete1 ( el , md )
unbindKey ( v , "space" , "down" , MarkerHit1 )
end
addEventHandler ( "onMarkerLeave" , mar1 , Delete1 )
end
end )
Wysłany: 2020-03-17, 22:02
P.Wiśnia
Programista LUA
Wiek: 24 Na forum: 4044 dni Posty: 568
Nick w MP: P.Wiśnia
Piwa : 376
Wysłany: 2020-03-18, 00:31
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Ostatnie 12 linijke to totalny chaos, bindujesz przycisk w funkcji w p?tli w evencie. Ogarnij najpierw kod i daj zna? czy pomog?o (bo na pewno to jest powodem, z?y argument w bindKey).
Wysłany: 2020-03-21, 21:16
QjubS
Wiek: 27 Na forum: 2300 dni Posty: 2
Nick w MP: QjubS
Okej ogarn??em kod teraz wszystko dzia?a
bra1 = createObject ( 968 , 1409.7998046875 ,- 1862.099609375 , 13.39999961853 , 0 , 90 , 0 )
mar1 = createMarker ( 1413.3000488281 , - 1862.4000244141 , 12.300000190735 , 'cylinder' , 10.0 , 0 , 0 , 255 , 0 )
function wyliczProcent1 ( czas , czas_ruchu )
local czas_aktualny = getTickCount ( ) - czas
return math . min ( czas_aktualny / czas_ruchu , 1 )
end
openclose = true
function MarkerHit1 ( hitPlayer , matchingDimension )
local jestOtwarty = getElementData ( bra1 , "otwary" )
local x , y , z = getElementPosition ( bra1 )
local czas = getElementData ( bra1 , "uruchomiony" ) or 0
local procent = wyliczProcent1 ( czas , 1000 )
local playera = hitPlayer
if isElementWithinMarker ( playera , mar1 ) then
if getElementType ( playera ) == "player" then
if isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( playera ) ), aclGetGroup ( 'Urzad' ) ) then
if jestOtwarty then
openclose = false
moveObject ( bra1 , 1000 * procent , x , y , z , 0 , 90 * procent , 0 )
else
openclose = true
moveObject ( bra1 , 1000 * procent , x , y , z , 0 , - 90 * procent , 0 )
end
end
setElementData ( bra1 , "otwary" , not jestOtwarty )
local tick = getTickCount ( ) - 1000 *( 1 - procent )
setElementData ( bra1 , "uruchomiony" , tick )
end
end
end
function bindKey1 ( plr )
bindKey ( source or plr , "space" , "down" , MarkerHit1 )
end
addEventHandler ( "onPlayerJoin" , root , bindKey1 )
Tagi: niedziałający :: przycisk
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: