Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-09-16, 11:51


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

po w??czeniu hudu wywala mas? b??d?w. db3 :
linijka :
function glodny()
    local glod = getElementData( localPlayer, "najedzenie" )
    if glod then
          if glod == 0 then return end
            setElementData( localPlayer, "najedzenie" - 1 )
    end
end
setTimer(glodny,"5000",0)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 11:52


nanKy







Wiek: 23
Na forum: 4007 dni
Posty: 498
Nick w MP: nanky

Piwa: 1775

Respekt: 239
Respekt: 239Respekt: 239

function glodny()
    local glod = (getElementData( localPlayer, "najedzenie" ) or 0)
    if glod then
          if glod == 0 then return end
            setElementData( localPlayer, "najedzenie",glod-1)
    end
end
setTimer(glodny,"5000",0)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 11:54


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Po zrestartowaniu hudu ci?gle dedam

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 11:58


_jvneczek







Wiek: 22
Na forum: 4467 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

darecky02, bo masz 0 % To co si? dziwisz :P

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 11:59


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Thinks, nawet je?li nakarmie siebie do 100% to po chwili nagle do zera.

[ Dodano: 2018-09-16, 12:10 ]
I ?eby hud mi sie pojawi? musz? klikn?? f2, a jak znowu klikne to znika..

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 16:08


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Sprawd?:
function glodny()
    local glod = (getElementData( localPlayer, "najedzenie" ) or 0)
    if glod and glod > 0 then
            setElementData( localPlayer, "najedzenie",glod-1)
    end
end
setTimer(glodny,5000,0)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 16:38


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Nie wywala b??d?w lecz nie nadaje mi paska g?odu..

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 17:30


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Nie rozumiem. Jakiego paska g?odu?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 17:52


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Po zjedzeniu nie zape?nia si? pasek najedzenia

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 17:54


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Mo?e podasz kod?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 19:53


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

local sx,sy = guiGetScreenSize()
local baseX = 1920
local zoom = 1.0
local minZoom = 2 
if sx < baseX then 
    zoom = math.min(minZoom, baseX/sx)
end

local glod = nil
local f = dxCreateFont("f.ttf", 14)
local f2 = dxCreateFont("f.ttf", 15)

local background = dxCreateTexture("i/hud_background.png", "argb", true, "clamp")

local background_x, background_y, background_w, background_h = 1552/zoom, 10/zoom, 358/zoom, 118/zoom
local rectangle1_x, rectangle1_y, rectangle1_w, rectangle1_h = 1857/zoom, 20/zoom, 8/zoom, 83/zoom
local rectangle2_x, rectangle2_y, rectangle2_w, rectangle2_h = 1875/zoom, 20/zoom, 8/zoom, 83/zoom
local rectangle3_x, rectangle3_y, rectangle3_w, rectangle3_h = 1893/zoom, 20/zoom, 8/zoom, 83/zoom
local money_x, money_y, money_w, money_h = 1641/zoom, 53/zoom, 1748/zoom, 76/zoom
local rp_x, rp_y, rp_w, rp_h = 1552/zoom, 91/zoom, 1628/zoom, 118/zoom
local nick_x, nick_y, nick_w, nick_h = 1641/zoom, 20/zoom, 1748/zoom, 43/zoom
local data_x, data_y, data_w, data_h = 1759/zoom, 21/zoom, 1834/zoom, 43/zoom
local time_x, time_y, time_w, time_h = 1759/zoom, 54/zoom, 1834/zoom, 76/zoom

-- # system glodu # --

local glod = nil

function glodny()
    local glod = getElementData( localPlayer, "najedzenie" )
    if glod then
          if glod == 0 then return end
            setElementData( localPlayer, "najedzenie" - 1 )
    end
end
setTimer(glodny,"5000",0)

-- # hud # --

addEventHandler("onClientRender",getRootElement(),function()
    local money = getElementData(localPlayer, "pieniadze")
    local full = 1
       local hp = getElementHealth(localPlayer)
       local armour = getPlayerArmor(localPlayer)
    local rp = getElementData(localPlayer, "punkty") or 0
    local time = getRealTime()
    local hours = time.hour
    local minutes = time.minute
    local day = time.monthday
    local months = time.month + 1
    local year = time.year + 1900
    local nick = getPlayerName(localPlayer)
    local stan_glodu = getElementData(localPlayer, "najedzenie")
    dxDrawImage(background_x, background_y, background_w, background_h, background, 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawRectangle(rectangle1_x, rectangle1_y, rectangle1_w, 83/zoom*hp/100, tocolor(203, 61, 61, 255), false)
    dxDrawRectangle(rectangle2_x, rectangle2_y, rectangle2_w, 83/zoom*armour/100, tocolor(4, 134, 255, 255), false)
    dxDrawRectangle(rectangle3_x, rectangle3_y, rectangle3_w, 83/zoom*stan_glodu/100, tocolor(255, 156, 60, 255), false)
    dxDrawText("#096809$#cccccc"..money.."", money_x, money_y, money_w, money_h, tocolor(255, 255, 255, 255), 1, f2, "center", "center",false,false,false,true,true)
    dxDrawText(""..rp.." rp", rp_x, rp_y, rp_w, rp_h, tocolor(255, 255, 255, 255), 1, f2, "center", "center",false,false,false,true,true)
    dxDrawText(nick, nick_x, nick_y, nick_w, nick_h, tocolor(255, 255, 255, 255), 1, f2, "center", "center",false,false,false,true,true)
    dxDrawText(""..hours..":"..minutes, time_x, time_y, time_w, time_h, tocolor(255, 255, 255, 255), 1, f2, "center", "center",false,false,false,true,true)
    dxDrawText(""..day.."."..months.."."..year.."", data_x, data_y, data_w, data_h, tocolor(255, 255, 255, 255), 1, f2, "center", "center",false,false,false,true,true)
end)

local ukryj = {
"ammo",
"armour",
"clock",
"health",
"money",
"weapon",
"wanted",
"clock"
}

addEventHandler("onClientResourceStart", resourceRoot,
    function()
    for k, schowaj in ipairs(ukryj) do
        showPlayerHudComponent(schowaj, false)
        
    end
   


addEventHandler("onClientResourceStop", resourceRoot, function()
    if(isElement(hud_background)) then
    destroyElement(hud_background)
    end
end)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 20:20


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Mam pytanie - w og?le sprawdzi?e? zmodyfikowany kod, kt?ry wys?a?em Ci?
function glodny()
    local glod = (getElementData( localPlayer, "najedzenie" ) or 0)
    if glod and glod > 0 then
            setElementData( localPlayer, "najedzenie",glod-1)
    end
end
setTimer(glodny,5000,0)


A w kodzie masz inny:
function glodny()
    local glod = getElementData( localPlayer, "najedzenie" )
    if glod then
          if glod == 0 then return end
            setElementData( localPlayer, "najedzenie" - 1 )
    end
end
setTimer(glodny,"5000",0)


Cytat:

Po zjedzeniu nie zape?nia si? pasek najedzenia

Podaj kod, kt?rym dodajesz najedzenie do aktualnego najedzenia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-16, 21:49


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

dlaczego if glod == 0 ma byc true? (if glod tutaj glod to bool a nie int) a w polaczeniu z AND nie bedzei dzialac poprawnie. albo w ifie sprawdzajcie sama date albo poprawnie ja zapiszcie

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: string
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku