Wysłany: 2013-07-05, 21:49
cayman11
Wiek: 30 Na forum: 4947 dni Posty: 73
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()),
function()
healthColor = tocolor ( 0 , 0 , 0 , 255 )
healthbgColor = tocolor ( 255 , 151 , 0 , 127 )
healthfgColor = tocolor ( 255 , 151 , 0 , 185 )
sx , sy = guiGetScreenSize ()
vehiclehealthx = sx / 800 * 619
vehiclehealthy = sy / 600 * 169
vehiclehealthxoverlay = sx / 800 * 621
vehiclehealthyoverlay = sy / 600 * 171
pasek = false
end )
function render ()
if ( pasek == false ) then
if ( isPedInVehicle ( getLocalPlayer ())) then
local health = getElementHealth ( getPedOccupiedVehicle ( getLocalPlayer ()))/ 1000 -- to jest 18 linijka
dxDrawRectangle ( vehiclehealthx , vehiclehealthy , 152 , 12 , healthColor , false )
dxDrawRectangle ( vehiclehealthxoverlay , vehiclehealthyoverlay , 148 , 8 , healthbgColor , false )
dxDrawRectangle ( vehiclehealthxoverlay , vehiclehealthyoverlay , 148 * health , 8 , healthfgColor , false )
end
end
end
addEventHandler ( "onClientRender" , getRootElement (), render )
Wszystko ?adnie dzia?a tylko wywala mi taki b??d i nie wiem czemu ;/
pomo?e kto???
Wysłany: 2013-07-07, 20:07
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
local localplayer = getLocalPlayer ()
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()),
function()
healthColor = tocolor ( 0 , 0 , 0 , 255 )
healthbgColor = tocolor ( 255 , 151 , 0 , 127 )
healthfgColor = tocolor ( 255 , 151 , 0 , 185 )
sx , sy = guiGetScreenSize ()
vehiclehealthx = sx / 800 * 619
vehiclehealthy = sy / 600 * 169
vehiclehealthxoverlay = sx / 800 * 621
vehiclehealthyoverlay = sy / 600 * 171
pasek = false
end )
function render ()
if ( pasek == false ) then
if ( isPedInVehicle ( localplayer )) then
currenthealth = getElementHealth ( getPedOccupiedVehicle ( localPlayer ))
health = math . floor ( currenthealth / 10 )
dxDrawRectangle ( vehiclehealthx , vehiclehealthy , 152 , 12 , healthColor , false )
dxDrawRectangle ( vehiclehealthxoverlay , vehiclehealthyoverlay , 148 , 8 , healthbgColor , false )
dxDrawRectangle ( vehiclehealthxoverlay , vehiclehealthyoverlay , 148 * health , 8 , healthfgColor , false )
end
end
end
addEventHandler ( "onClientRender" , getRootElement (), render )
Wysłany: 2013-07-08, 23:11
cayman11
Wiek: 30 Na forum: 4947 dni Posty: 73
Wysłany: 2013-07-09, 11:29
Oski
LUA Scripter
Wiek: 30 Na forum: 5246 dni Posty: 428
Nick w MP: Oski
Piwa : 56
Robisz w sumie 3 grafiki.
1) Ciemny pasek wskazuj?cy dlugosc paska
2)Jasny pasek wskazujacy ile masz zycia
3) bialy krzyzyk
a reszta to funkcja dxDraw
Wysłany: 2013-07-09, 11:33
luki123luki123
Place Game
Wiek: 28 Na forum: 5275 dni Posty: 1948
Nick w MP: LuKiO
Piwa : 6101
nie lepiej by by?o przy pomocy guiCreateProgressBar i guiCreateStaticImage
Wysłany: 2013-07-09, 11:59
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
"luki123luki123" napisał/a :nie lepiej by by?o przy pomocy guiCreateProgressBar i guiCreateStaticImage
Ciekawe. Ten Progress Bar po kij? Do tego guiCreateStaticImage i co? Co klatk? zmieniania rozmiaru by si? dopasowywa?o?
Zr?b jak napisa? Oski. Jeden obrazek jako ciemne t?o, kt?re jest ci?gle takiego samego rozmiaru i drugi obrazek - jasny gdzie masz pozycj? obrazku tak? sam? jak w przypadku t?a z wyj?tkiem d?ugo?ci obrazka. D?ugo?? obrazka liczysz za pomoc? algorytmu na przyk?adzie ?ycia:
stan zycia / maksymalna liczba zycia * d?ugo?? t?a (gdy pasek jest caly)
Wysłany: 2013-07-09, 19:26
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Albo Panowie robimy jeden obrazeczek, dxDrawImage i go odpowiednio koloryzujemy, nadajemy odpowiedni? prze?roczysto?? i ?miga .
Tagi: pasek :: stanu :: auta
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: