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

Wysłany: 2021-01-22, 01:33


Lucky!!! :)







Wiek: 21
Na forum: 2513 dni
Posty: 121
Nick w MP: Lucky

Piwa: 1163

Respekt: 50

Witam, chc? zrobi?, aby w wersji serwera by?a godzina, lecz si? ona od?wie?a jedynie poprzez zresetowanie skryptu. Pomo?e kto?, daje piwka? :P

Version={
    m_string='',
    m_label=nil,
}

local screenWidth, screenHeight=GuiElement.getScreenSize()
local time = getRealTime()
local hours = time.hour
local minutes = time.minute
local seconds = time.second
local miesiacday = time.monthday
local miesiac = time.month    
local year = time.year

if (hours < 10) then
    hours = "0"..hours
end
if (minutes < 10) then
    minutes = "0"..minutes
end
if (seconds < 10) then
    seconds = "0"..seconds
end

function init()
local pidek = getElementData(localPlayer,"player:sid")
    Version.m_string=''..hours..':'..minutes..':'..seconds..' | AmperRPG v1'

    Version.m_label=guiCreateLabel(screenWidth-338, screenHeight-15, 250, 18, Version.m_string .. ' |', false)
    guiSetAlpha(Version.m_label, 0.5)
    guiLabelSetHorizontalAlign(Version.m_label, 'right')
end
init()

function destroy()
    if Version.m_label then
        Version.m_label:destroy()
    end
end

function setString(version)
    Version.m_string=version
end

function getString()
    return Version.m_string
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-22, 07:12


Mikołajj







Wiek: 23
Na forum: 3026 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

W takim razie zmienne pochodne od getRealTime() oraz wszystkie warunki musisz umie?ci? w onClientRender, ?eby to mia?o logik?, wtedy czas b?dzie si? od?wie?a? co klatk? przez gta

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-22, 15:27


Lucky!!! :)







Wiek: 21
Na forum: 2513 dni
Posty: 121
Nick w MP: Lucky

Piwa: 1163

Respekt: 50

Miko?ajj,

Wszystko spoko, tylko teraz tak jakby nak?adaj? si? na siebie te guilabel i jest troch? ?le. Co robi? ?le?


Kod:

Version={
m_string='',
m_label=nil,
}

local screenWidth, screenHeight=GuiElement.getScreenSize()

function init()
local time = getRealTime()
local hours = time.hour
local minutes = time.minute
local seconds = time.second
local miesiacday = time.monthday
local miesiac = time.month
local year = time.year

if (hours < 10) then
hours = "0"..hours
end
if (minutes < 10) then
minutes = "0"..minutes
end
if (seconds < 10) then
seconds = "0"..seconds
end
Version.m_string=''..hours..':'..minutes..':'..seconds..' | AmperRPG v1'
Version.m_label=guiCreateLabel(screenWidth-338, screenHeight-15, 250, 18, Version.m_string .. ' |', false)
guiSetAlpha(Version.m_label, 0.5)
guiLabelSetHorizontalAlign(Version.m_label, 'right')
end
addEventHandler("onClientRender", root, init)

function destroy()
if Version.m_label then
Version.m_label:destroy()
end
end

function setString(version)
Version.m_string=version
end

function getString()
return Version.m_string
end


Postaw piwo autorowi tego posta
 

 
Tagi: godzina :: wersji :: serwera
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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