Wysłany: 2019-12-30, 01:13
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
Kod:
local font = dxCreateFont ("font.ttf", 13) -- czcionka
addEventHandler("onClientRender", root, function(Dupas2)
if not getElementData(localPlayer, "player:logged") then return end -- linijka dzi?™ki ktĂłrej hud pokaĹĽe si?™ dopiero po zalogowaniu
setPlayerHudComponentVisible("ammo", false)
setPlayerHudComponentVisible("area_name", false)
setPlayerHudComponentVisible("armour", false)
setPlayerHudComponentVisible("breath", false)
setPlayerHudComponentVisible("clock", false)
setPlayerHudComponentVisible("health", false)
setPlayerHudComponentVisible("money", false)
setPlayerHudComponentVisible("vehicle_name", false)
setPlayerHudComponentVisible("weapon", false)
setPlayerHudComponentVisible("radio", false)
setPlayerHudComponentVisible("wanted", false)
mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local hp = getElementHealth(localPlayer) -- Zycie
local hpp = string.format("%d", hp)
local realtime = getRealTime() --Realna godzina i data
time_h = realtime.hour
time_m = realtime.minute
time_s = realtime.second
time_dzien = realtime.monthday
time_mies = realtime.month
time_rok = realtime.year+1900
local godzina = string.format("%02d:%02d", time_h, time_m)
local data = string.format("%02d.%02d.%02d", time_dzien, time_mies, time_rok)
local rp = getElementData(localPlayer, "player:srp") or 0 --na ogrpg player:reputation//reputacja
local money = getPlayerMoney() -- pieni?…dze
dxDrawImage(430*w, 5*h, 500*w, 83*h, "hud.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(755*w, 38*h, (142*w)*hp/100, 17*h, tocolor(243, 35, 35, 255), false)
dxDrawText(godzina, 7*w, 10*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText(data, 7*w, 60*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("RP: "..rp.."", -307*w, 20*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("PLN: "..money.."", -307*w, 60*h, 1356*w, 61*h, tocolor(9, 128, 28, 255), 1.00, font, "center", "center", false, false, false, true, false)
end)
bindKey ("f5","down",Dupas2)
czy to jest poprawnie je?li nie to czy m?g?by go ktos poprawi??
problem jak w temacie
Wysłany: 2019-12-30, 01:28
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
Sprawdzasz czy mapa jest widoczna, je?li tak nic nie renderujesz je?li nie, rederujesz hud
b?d?
Więcej informacji znajdziesz w Wikipedii MTA: bindKey
ze zmienn? kt?ra je?li jest r?wna np. true wtedy jest renderowany hud
Wysłany: 2019-12-30, 01:33
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
@Szypki_exe w?asnie nie wiem czy mam poprawnie tego bindkey wiesz
Wysłany: 2019-12-30, 01:39
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :@Szypki_exe w?asnie nie wiem czy mam poprawnie tego bindkey wiesz
Z podanego kodu wynika ?e bindKey nie jest przypisany do ?adnej funkcji - poczytaj o tym
Więcej informacji znajdziesz w Wikipedii MTA: bindKey
masz tam nawet podane przyk?ady
Musisz stworzy? funkcj? przypisan? do niego kt?ra t? zmienn? b?dzie zmienia?a - jednak?e o wiele prostszym sposobem jest zastosowanie isPlayerMapVisable kt?re poda?em powy?ej
Wysłany: 2019-12-30, 01:51
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
Dalej niestety nie rozumiem w jaki spos?b mam nazwa? to, wiem ze musze to pod??czy? jako funkcje tylko jak nazwa? wszystko w hudzie zebym m?g? to podbindowa??
[ Dodano : 2019-12-30, 01:58 ]
function funcInput ( onClientRender, root, function)
addEventHandler("onClientRender", root, function()
w taki spos?b?
Wysłany: 2019-12-30, 02:08
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :Dalej niestety nie rozumiem w jaki spos?b mam nazwa? to, wiem ze musze to pod??czy? jako funkcje tylko jak nazwa? wszystko w hudzie zebym m?g? to podbindowa??
[ Dodano : 2019-12-30, 01:58 ]
function funcInput ( onClientRender, root, function)
addEventHandler("onClientRender", root, function()
w taki spos?b?
Nie rozumiem co Ty tutaj pr?bujesz stworzy?
Tworzysz zmienn?:
funkcj?:
function przyklad ()
if zmienna == false then
zmienna = true
else
zmienna = false
end
end )
i na bind:
bindKey ( "klawisz" , "status" , przyklad )
i w onClientRender sprawdzasz jaki jest status "zmienna", je?li false to nie renderujesz, je?li true to renderujesz
ale tak jak t?umaczy?em powy?ej jest to zb?dne, wystarczy isPlayerMapVisible - wtedy nie musisz stosowac ?adnych bind?w, hud w momencie gdy mapa bedzie w?aczona sam zniknie
Ostatnio zmieniony przez Szypki_exe 2019-12-30, 02:35, w całości zmieniany 1 raz
Wysłany: 2019-12-30, 02:21
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
Nie chowa si? hud pod ./showhud - natomiast nie wiem czy to ma jaki? zwi?zek z tym poniewa? powinien mi dzia?a? taki kod
Kod: local font = dxCreateFont ("font.ttf", 13) -- czcionka
addEventHandler("onClientRender", root, function()
if not getElementData(localPlayer, "player:logged") then return end -- linijka dzi?™ki ktĂłrej hud pokaĹĽe si?™ dopiero po zalogowaniu
setPlayerHudComponentVisible("ammo", false)
setPlayerHudComponentVisible("area_name", false)
setPlayerHudComponentVisible("armour", false)
setPlayerHudComponentVisible("breath", false)
setPlayerHudComponentVisible("clock", false)
setPlayerHudComponentVisible("health", false)
setPlayerHudComponentVisible("money", false)
setPlayerHudComponentVisible("vehicle_name", false)
setPlayerHudComponentVisible("weapon", false)
setPlayerHudComponentVisible("radio", false)
setPlayerHudComponentVisible("wanted", false)
mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local hp = getElementHealth(localPlayer) -- Zycie
local hpp = string.format("%d", hp)
local realtime = getRealTime() --Realna godzina i data
time_h = realtime.hour
time_m = realtime.minute
time_s = realtime.second
time_dzien = realtime.monthday
time_mies = realtime.month
time_rok = realtime.year+1900
local godzina = string.format("%02d:%02d", time_h, time_m)
local data = string.format("%02d.%02d.%02d", time_dzien, time_mies, time_rok)
local rp = getElementData(localPlayer, "player:srp") or 0 --na ogrpg player:reputation//reputacja
local money = getPlayerMoney() -- pieni?…dze
dxDrawImage(430*w, 5*h, 500*w, 83*h, "hud.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(755*w, 38*h, (142*w)*hp/100, 17*h, tocolor(243, 35, 35, 255), false)
dxDrawText(godzina, 7*w, 10*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText(data, 7*w, 60*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("RP: "..rp.."", -307*w, 20*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("PLN: "..money.."", -307*w, 60*h, 1356*w, 61*h, tocolor(9, 128, 28, 255), 1.00, font, "center", "center", false, false, false, true, false)
showPlayerHudComponent('all', false)
showPlayerHudComponent('radar', true)
end)
function showHide_HUD()
if show == 1 then
show = 0
else
show = 1
end
end
bindKey("F11","up",showHide_HUD)
Wysłany: 2019-12-30, 02:24
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :Nie chowa si? hud pod ./showhud - natomiast nie wiem czy to ma jaki? zwi?zek z tym poniewa? powinien mi dzia?a? taki kod
Kod: local font = dxCreateFont ("font.ttf", 13) -- czcionka
addEventHandler("onClientRender", root, function()
if not getElementData(localPlayer, "player:logged") then return end -- linijka dzi?™ki ktĂłrej hud pokaĹĽe si?™ dopiero po zalogowaniu
setPlayerHudComponentVisible("ammo", false)
setPlayerHudComponentVisible("area_name", false)
setPlayerHudComponentVisible("armour", false)
setPlayerHudComponentVisible("breath", false)
setPlayerHudComponentVisible("clock", false)
setPlayerHudComponentVisible("health", false)
setPlayerHudComponentVisible("money", false)
setPlayerHudComponentVisible("vehicle_name", false)
setPlayerHudComponentVisible("weapon", false)
setPlayerHudComponentVisible("radio", false)
setPlayerHudComponentVisible("wanted", false)
mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
local hp = getElementHealth(localPlayer) -- Zycie
local hpp = string.format("%d", hp)
local realtime = getRealTime() --Realna godzina i data
time_h = realtime.hour
time_m = realtime.minute
time_s = realtime.second
time_dzien = realtime.monthday
time_mies = realtime.month
time_rok = realtime.year+1900
local godzina = string.format("%02d:%02d", time_h, time_m)
local data = string.format("%02d.%02d.%02d", time_dzien, time_mies, time_rok)
local rp = getElementData(localPlayer, "player:srp") or 0 --na ogrpg player:reputation//reputacja
local money = getPlayerMoney() -- pieni?…dze
dxDrawImage(430*w, 5*h, 500*w, 83*h, "hud.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawRectangle(755*w, 38*h, (142*w)*hp/100, 17*h, tocolor(243, 35, 35, 255), false)
dxDrawText(godzina, 7*w, 10*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText(data, 7*w, 60*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("RP: "..rp.."", -307*w, 20*h, 1356*w, 61*h, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, true, false)
dxDrawText("PLN: "..money.."", -307*w, 60*h, 1356*w, 61*h, tocolor(9, 128, 28, 255), 1.00, font, "center", "center", false, false, false, true, false)
showPlayerHudComponent('all', false)
showPlayerHudComponent('radar', true)
end)
function showHide_HUD()
if show == 1 then
show = 0
else
show = 1
end
end
bindKey("F11","up",showHide_HUD)
nie chowa si? bo w renderze nie sprawdzasz warto?ci zmiennej "show"
if show == 0 then return end
Wysłany: 2019-12-30, 02:26
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
Tylko ?e ja tego isPlayerMapVisible kompletnie nie rozumiem a nie mam niestandardowej mapki
Wysłany: 2019-12-30, 02:29
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :Tylko ?e ja tego isPlayerMapVisible kompletnie nie rozumiem a nie mam niestandardowej mapki
To jest funkcja wbudowana w mta, a nie ?adna customowa mapka
stosujesz to identycznie tak jak poda?em powy?ej - tylko sprawdzanie zmiennej zmieniasz na isPlayerMapVisible
Ostatnio zmieniony przez Szypki_exe 2019-12-30, 02:41, w całości zmieniany 1 raz
Wysłany: 2019-12-30, 02:30
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
a mo?esz mi to przerobi? i wys?a? jak to ma wygl?da? w skrypcie?
[ Dodano : 2019-12-30, 02:31 ]
function showMap()
if isPlayerMapVisible() then
outputChatBox("Radar closed", 0, 255, 0)
forcePlayerMap(false)
else
outputChatBox("Viewing radar", 0, 255, 0)
forcePlayerMap(true)
end
end
addCommandHandler("showmap", showMap)
bo rozumiem ?e to mam wrzuci? tak?
Wysłany: 2019-12-30, 02:34
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :a mo?esz mi to przerobi? i wys?a? jak to ma wygl?da? w skrypcie?
Poda?em Ci co masz wklei? do onClientRender, takie to trudne?
Masz nawet ju? tam sprawdzanie czy gracz posiada ElementDate "player:logged" - potraktuj to jako przyk?ad i wklej to
if isPlayerMapVisible then return end
Wysłany: 2019-12-30, 02:45
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
tak?
function showHide_isPlayerMapVisible()
if isPlayerMapVisible == 1 then
isPlayerMapVisible = 0
else
isPlayerMapVisible = 1
end
end
bindKey("F11","up",showHide_isPlayerMapVisible)
Wysłany: 2019-12-30, 02:51
Szypki_exe
Wiek: 21 Na forum: 3239 dni Posty: 172
Piwa : 1426
"AmLotte" napisał/a :tak?
function showHide_isPlayerMapVisible()
if isPlayerMapVisible == 1 then
isPlayerMapVisible = 0
else
isPlayerMapVisible = 1
end
end
bindKey("F11","up",showHide_isPlayerMapVisible)
isPlayerMapVisible to jest funkcja wbudowana w mta!! Nie musisz jej sam tworzy? - wystaczy ?e przeanalizujesz to co napisalem po wy?ej.
Je?li z tym sobie nie poradzisz zatrudnij jakiego? programist? i poczytaj/poogl?daj wieeeele poradnik?w o LUA - gdy? aby rozwi?za? ten problem tak naprawd? wystarczy?aby moja jedna wypowied?
Wysłany: 2019-12-30, 02:55
AmLotte
Wiek: 42 Na forum: 2478 dni Posty: 43
Nick w MP: AmLotte
Piwa : 381
Ale gdzie mam tego szuka? niby?
Tagi: jak :: pod :: f11 :: chowac :: hud?
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: