Wysłany: 2020-03-06, 15:32
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Witam, ot?? totalnie nie mam pomys?u, jak zrobi? randomowe punkty w dxDrawImage.
Tutaj tabela punkt?w
local mousePoints = {
{ screenW * 0.3932 , screenH * 0.4787 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.4516 , screenH * 0.5213 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5495 , screenH * 0.5528 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5969 , screenH * 0.5065 , screenW * 0.0198 , screenH * 0.0296 },
}
target = 0
Tutaj kod na punkty. Chcia?bym go nieco przerobi?, by punkty by?y losowane z tabeli wy?ej
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "kopalnia:zakonczono" ) then return end
dxDrawImage ( mousePoints [ target ][ 1 ], mousePoints [ target ][ 2 ], mousePoints [ target ][ 3 ], mousePoints [ target ][ 4 ], "kolo.png" )
end )
Za pomoc zimne
Wysłany: 2020-03-06, 17:57
P.Wiśnia
Programista LUA
Wiek: 24 Na forum: 4045 dni Posty: 568
Nick w MP: P.Wiśnia
Piwa : 376
local mousePoints = {
{ screenW * 0.3932 , screenH * 0.4787 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.4516 , screenH * 0.5213 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5495 , screenH * 0.5528 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5969 , screenH * 0.5065 , screenW * 0.0198 , screenH * 0.0296 },
}
target = 0
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "kopalnia:zakonczono" ) then return end
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
dxDrawImage ( x , y , w , h , "kolo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end )
Wysłany: 2020-03-06, 18:15
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
W powy?szym kodzie nad linijk?
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
musisz dopisa? to:
local rnd = math . random ( #mousePoints)
Wysłany: 2020-03-07, 14:01
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Doda?em wszystko do kodu. Lecz jak wejde w marker, to punkty si? same losuj? i lataj? po ekranie, nie klikaj?c nic punkty same si? losuja i lataj? po ekranie.
kod
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "kopalnia:zakonczono" ) then return end
local rnd = math . random ( #mousePoints)
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
dxDrawImage ( x , y , w , h , "kolo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end )
Wysłany: 2020-03-07, 14:06
P.Wiśnia
Programista LUA
Wiek: 24 Na forum: 4045 dni Posty: 568
Nick w MP: P.Wiśnia
Piwa : 376
"Wilq" napisał/a :W powy?szym kodzie nad linijk?
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
musisz dopisa? to:
local rnd = math . random ( #mousePoints)
?le podpowiedzia?e?:
local mousePoints = {
{ screenW * 0.3932 , screenH * 0.4787 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.4516 , screenH * 0.5213 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5495 , screenH * 0.5528 , screenW * 0.0323 , screenH * 0.0509 },
{ screenW * 0.5969 , screenH * 0.5065 , screenW * 0.0198 , screenH * 0.0296 },
}
local rnd = math . random ( 1 , #mousePoints) -- lub to na dole
local rnd = math . random ( #mousePoints)
target = 0
addEventHandler ( "onClientRender" , root , function()
if getElementData ( localPlayer , "kopalnia:zakonczono" ) then return end
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
dxDrawImage ( x , y , w , h , "kolo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end )
Ostatnio zmieniony przez P.Wiśnia 2020-03-07, 15:03, w całości zmieniany 1 raz
Wysłany: 2020-03-07, 14:26
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Obraz si? nie wczytuje, punkty te? si? nie wczytuja.
B??d w DB3
Kod:
attempt to index field "?" (a nil value)
B??d w tej linijce
local x , y , w , h = mousePoints [ rnd ][ 1 ], mousePoints [ rnd ][ 2 ], mousePoints [ rnd ][ 3 ], mousePoints [ rnd ][ 4 ]
Tagi: randomowe :: punkty
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: