GTA Közösség - A magyar GTA fórum

Multi Theft Auto (MTA) => MTA: Szerverfejlesztés => Segítségkérés => A témát indította: danika98766 - 2016. augusztus 15. - 18:06:09

Cím: Státusz
Írta: danika98766 - 2016. augusztus 15. - 18:06:09
Helló, láttam már sok szerveren hogy a jobb alsó sarkok-ban ki van írva a szerver neve a szerveren töltött idő pl:(1 óra 30 perc 10 másodperc) a dátumot stb.. ezt hogy lehet megcsinálni?
Cím: Státusz
Írta: AnthonyGates - 2016. augusztus 15. - 18:22:57
Textdraw
Timer
TextDrawSetString
Cím: Státusz
Írta: impreZZa - 2016. augusztus 15. - 18:25:36
Idézetet írta: impreZZa date=1471248647\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62665\" data-ipsquote-contentclass=\"forums_Topic

\"903008fcc0e34ec0900c9b7764a51272.png\"

[/quote]
https://wiki.multitheftauto.com/wiki/DxDrawText
https://wiki.multitheftauto.com/wiki/GetElementData
Cím: Státusz
Írta: Xistance - 2016. augusztus 16. - 02:45:30
function secondsToTimeDesc( seconds )
if seconds then
local results = {}
local sec = ( seconds %60 )
local min = math.floor ( ( seconds % 3600 ) /60 )
local hou = math.floor ( ( seconds % 86400 ) /3600 )
local day = math.floor ( seconds /86400 )
 
if day > 0 and day < 10 then table.insert( results, day .. ( day == 1 and \" day\" or \" days\" ) )
elseif day > 0  then table.insert( results, day .. ( day == 1 and \"\" or \"\" ) ) end
if hou >= 0 and hou < 10 then table.insert( results, \"0\"..hou .. ( hou == 1 and \"\" or \"\" ) )
elseif hou > 0  then table.insert( results, hou .. ( hou == 1 and \"\" or \"\" ) ) end
if min >= 0 and min < 10 then table.insert( results, \"0\"..min .. ( min == 1 and \"\" or \"\" ) )
elseif min > 0  then table.insert( results, min .. ( hou == 1 and \"\" or \"\" ) ) end
if sec >= 0 and sec < 10 then table.insert( results, \"0\"..sec .. ( sec == 1 and \"\" or \"\" ) )
elseif sec > 0  then table.insert( results, sec .. ( sec == 1 and \"\" or \"\" ) ) end
return string.reverse ( table.concat ( results, \":\" ):reverse():gsub(\":\", \":\", 1 ) )
end
return \"\"
end
 
setElementData(localPlayer,\"onlineTime\",0)
setTimer(function()
setElementData(localPlayer,\"onlineTime\",getElementData(localPlayer,\"onlineTime\") + 1)
end,1000,0)
+ kiíratás
dxDrawText (secondsToTimeDesc(tonumber(getElementData(v, \"onlineTime\") or 0)), x,y, sizex, sizey, tocolor(255,255,255, 255), 1, font, \"left\", \"top\", false, false, true, true)