Wysłany: 2020-12-04, 14:44
xyzzzikk
.gg
Wiek: 18 Na forum: 2774 dni Posty: 175
Nick w MP: aspyk
Piwa : 6499
Nada?em hud'owi elementdate "hud" po wci?ni?ciu f2 powinnen znika? lecz nie znika
-- last edit
local sx , sy = guiGetScreenSize ()
setPlayerHudComponentVisible ( "all" , false )
setPlayerHudComponentVisible ( "radar" , true )
function sw ( value )
return sx * value / 1920
end
function sh ( value )
return sy * value / 1080
end
setElementData ( localPlayer , "hud" , true )
local font = dxCreateFont ( "gtav.ttf" , sw ( 20 ))
local font2 = dxCreateFont ( "normal.ttf" , sw ( 14 ))
local pos ={
server = { x = 2700 , y = - 525 , w = 825 , h = 627 },
imgHud = { x = 0 , y = 0 , w = 1920 , h = 1080 },
imgKolo = { x = 0 , y = 0 , w = 115 , h = 115 }
}
local images ={
hud = dxCreateTexture ( 'img/hud.png' , 'argb' , false , 'clamp' ),
pasek = dxCreateTexture ( 'img/pasek.png' , 'argb' , false , 'clamp' ),
kolo = dxCreateTexture ( ':rn_avatars/kolo.png' , 'argb' , false , 'clamp' ),
}
function render ()
local player ={
name = getPlayerName ( localPlayer ),
money = przecinek ( getElementData ( localPlayer , "player:money" ) or 0 )
}
dxDrawImage ( sw ( pos [ "imgHud" ]. x ), sh ( pos [ "imgHud" ]. y ), sw ( pos [ "imgHud" ]. w ), sh ( pos [ "imgHud" ]. h ), images . hud , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
dxDrawImage ( sw ( pos [ "imgHud" ]. x ), sh ( pos [ "imgHud" ]. y ), sw ( pos [ "imgHud" ]. w ), sh ( pos [ "imgHud" ]. h ), images . pasek , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
dxDrawImage ( sw ( pos [ "imgHud" ]. x + 1535 ), sh ( pos [ "imgHud" ]. y + 63 ), sw ( pos [ "imgKolo" ]. w ), sh ( pos [ "imgKolo" ]. h ), images . kolo , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
exports [ "rn_avatars" ]: dxCreateAvatar ( sw ( pos [ "imgHud" ]. x + 1535 ), sh ( pos [ "imgHud" ]. y + 63 ), sw ( pos [ "imgKolo" ]. w ), sh ( pos [ "imgKolo" ]. h ))
dxDrawText ( player . name , sw ( pos [ "server" ]. x - 1160 ), sw ( pos [ "server" ]. y - 2 ), sw ( pos [ "server" ]. w ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font , "left" , "center" , true , true , true , true , true )
dxDrawText ( "" .. player . money .. " PLN" , sw ( pos [ "server" ]. x ), sw ( pos [ "server" ]. y + 240 ), sw ( pos [ "server" ]. w + 1025 ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font2 , "right" , "center" , true , true , true , true , true )
if getElementData ( localPlayer , "player:premiumplus" ) then
dxDrawText ( "#fcdf03Premium+" , sw ( pos [ "server" ]. x + 125 ), sw ( pos [ "server" ]. y - 2 ), sw ( pos [ "server" ]. w ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font , "center" , "center" , true , true , true , true , true )
end
end
addEventHandler ( "onClientRender" , root , render )
bindKey ( "F2" , "down" , function()
if getElementData ( localPlayer , "hud" ) then
setElementData ( localPlayer , "hud" , false )
showChat ( false )
else
setElementData ( localPlayer , "hud" , true )
showChat ( true )
end
end )
function przecinek ( liczba )
local format = liczba
while true do
format , k = string . gsub ( format , "^(-?%d+)(%d%d%d)" , '%1,%2' )
if ( k == 0 ) then
break
end
end
return format
end
Wysłany: 2020-12-04, 14:57
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
w kodzie nie masz uwzgl?dnionego znikania hudu, to tylko elementdata
je?li chcesz przesta? renderowa? hud to zastosuj w funkcji binda poprostu
i nast?pnie pojawi? go mo?esz identycznie tylko zamiast remove stosujesz
b?d? mo?esz u?y?
Wysłany: 2020-12-04, 15:24
EnoNeK
Wiek: 21 Na forum: 3287 dni Posty: 39
Nick w MP: EnoNeK
Piwa : 54
Czyli w praktyce z elementdat?
-- last edit
local sx , sy = guiGetScreenSize ()
setPlayerHudComponentVisible ( "all" , false )
setPlayerHudComponentVisible ( "radar" , true )
function sw ( value )
return sx * value / 1920
end
function sh ( value )
return sy * value / 1080
end
setElementData ( localPlayer , "hud" , true )
local font = dxCreateFont ( "gtav.ttf" , sw ( 20 ))
local font2 = dxCreateFont ( "normal.ttf" , sw ( 14 ))
local pos ={
server = { x = 2700 , y = - 525 , w = 825 , h = 627 },
imgHud = { x = 0 , y = 0 , w = 1920 , h = 1080 },
imgKolo = { x = 0 , y = 0 , w = 115 , h = 115 }
}
local images ={
hud = dxCreateTexture ( 'img/hud.png' , 'argb' , false , 'clamp' ),
pasek = dxCreateTexture ( 'img/pasek.png' , 'argb' , false , 'clamp' ),
kolo = dxCreateTexture ( ':rn_avatars/kolo.png' , 'argb' , false , 'clamp' ),
}
function render ()
if getElementData ( localPlayer , "hud" ) then
local player ={
name = getPlayerName ( localPlayer ),
money = przecinek ( getElementData ( localPlayer , "player:money" ) or 0 )
}
dxDrawImage ( sw ( pos [ "imgHud" ]. x ), sh ( pos [ "imgHud" ]. y ), sw ( pos [ "imgHud" ]. w ), sh ( pos [ "imgHud" ]. h ), images . hud , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
dxDrawImage ( sw ( pos [ "imgHud" ]. x ), sh ( pos [ "imgHud" ]. y ), sw ( pos [ "imgHud" ]. w ), sh ( pos [ "imgHud" ]. h ), images . pasek , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
dxDrawImage ( sw ( pos [ "imgHud" ]. x + 1535 ), sh ( pos [ "imgHud" ]. y + 63 ), sw ( pos [ "imgKolo" ]. w ), sh ( pos [ "imgKolo" ]. h ), images . kolo , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 200 ), false )
exports [ "rn_avatars" ]: dxCreateAvatar ( sw ( pos [ "imgHud" ]. x + 1535 ), sh ( pos [ "imgHud" ]. y + 63 ), sw ( pos [ "imgKolo" ]. w ), sh ( pos [ "imgKolo" ]. h ))
dxDrawText ( player . name , sw ( pos [ "server" ]. x - 1160 ), sw ( pos [ "server" ]. y - 2 ), sw ( pos [ "server" ]. w ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font , "left" , "center" , true , true , true , true , true )
dxDrawText ( "" .. player . money .. " PLN" , sw ( pos [ "server" ]. x ), sw ( pos [ "server" ]. y + 240 ), sw ( pos [ "server" ]. w + 1025 ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font2 , "right" , "center" , true , true , true , true , true )
if getElementData ( localPlayer , "player:premiumplus" ) then
dxDrawText ( "#fcdf03Premium+" , sw ( pos [ "server" ]. x + 125 ), sw ( pos [ "server" ]. y - 2 ), sw ( pos [ "server" ]. w ), sw ( pos [ "server" ]. h ), tocolor ( 230 , 230 , 230 , 255 ), 1.00 , font , "center" , "center" , true , true , true , true , true )
end
end
end
addEventHandler ( "onClientRender" , root , render )
bindKey ( "F2" , "down" , function()
if getElementData ( localPlayer , "hud" ) then
setElementData ( localPlayer , "hud" , false )
showChat ( false )
else
setElementData ( localPlayer , "hud" , true )
showChat ( true )
end
end )
function przecinek ( liczba )
local format = liczba
while true do
format , k = string . gsub ( format , "^(-?%d+)(%d%d%d)" , '%1,%2' )
if ( k == 0 ) then
break
end
end
return format
end
Tagi: hud :: nie :: znika
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: