Filexdoj

RealTime resource

Feb 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. --- meta.xml
  2. <meta>
  3. <script src="client.lua" type="client"/>
  4. </meta>
  5.  
  6. -- client.lua
  7. local screenW, screenH = guiGetScreenSize()
  8. local newScale = dxGetFontHeight (screenW/30000 , "pricedown" )
  9. local left   = screenW * 0.8764
  10. local top    = screenH * 0.0067
  11. local right  = screenW * 0.9966
  12. local bottom = screenH * 0.0267
  13.  
  14.  
  15. function drawTime()
  16.     local realTime = getRealTime()
  17.     local hours    = string.format("%02d",realTime.hour)
  18.     local minutes  = string.format("%02d",realTime.minute)
  19.     local seconds  = string.format("%02d",realTime.second)
  20.     local text = "Real Time : "..hours..":"..minutes..":"..seconds
  21.     dxDrawText(text ,left - 1, top - 1, right - 1 , bottom - 1, tocolor(0, 0, 0, 255),  newScale, "default", "center", "center", false, true, true, false, false)
  22.     dxDrawText(text ,left + 1, top - 1, right + 1 , bottom - 1, tocolor(0, 0, 0, 255),  newScale, "default", "center", "center", false, true, true, false, false)
  23.     dxDrawText(text ,left - 1, top + 1, right - 1 , bottom + 1, tocolor(0, 0, 0, 255),  newScale, "default", "center", "center", false, true, true, false, false)
  24.     dxDrawText(text ,left + 1, top + 1, right + 1 , bottom + 1, tocolor(0, 0, 0, 255),  newScale, "default", "center", "center", false, true, true, false, false)
  25.     dxDrawText(text ,left, top, right, bottom, tocolor(255, 255, 255, 255),  newScale, "default", "center", "center", false, true, true, false, false)
  26. end
  27. addEventHandler("onClientRender", getRootElement(), drawTime)
Add Comment
Please, Sign In to add comment