Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. local monitorSize = {guiGetScreenSize()}
  2. local state = 0
  3. local second = 100
  4. local font = dxCreateFont("files/font.otf", 10)
  5. function meghaltal()
  6. state = 1
  7. Idozito = setTimer ( countDown, 1000, 0)
  8. end
  9. addEventHandler ( "onClientPlayerWasted", getLocalPlayer(),meghaltal )
  10.  
  11. function countDown ()
  12. if second > 0 then
  13. second = second - 1
  14. elseif second <= 0 then
  15. outputChatBox("feléledtél!")
  16. end
  17. end
  18.  
  19. function renderPanel()
  20. if (state==1) then
  21. setCameraMatrix(399.52261352539, 2528.8083496094, 18.146799087524, 400.41943359375, 2529.1520996094, 17.86817741394)
  22. dxDrawText(secondsToTimeDesc(second), monitorSize[1]/2-600/2+600/2+1, monitorSize[2]/2-416/2+30+210+1, monitorSize[1]/2-600/2+600/2+1, monitorSize[2]/2-416/2+30+210+1, tocolor(0, 0, 0, 255), 1 ,font, "center", "center")
  23. dxDrawText(secondsToTimeDesc(second), monitorSize[1]/2-600/2+600/2, monitorSize[2]/2-416/2+30+210, monitorSize[1]/2-600/2+600/2+1, monitorSize[2]/2-416/2+30+210, tocolor(255, 255, 255, 255), 1 ,font, "center", "center")
  24. else
  25. setCameraTarget(localPlayer)
  26. state=0
  27. end
  28. end
  29. addEventHandler("onClientRender",root,renderPanel)
  30.  
  31. function hp()
  32. setElementHealth(localPlayer,0)
  33. end
  34. addCommandHandler("0", hp)
  35.  
  36. function secondsToTimeDesc( seconds )
  37. if seconds then
  38. local results = {}
  39. local sec = ( seconds %60 )
  40. local min = math.floor ( ( seconds % 3600 ) /60 )
  41. local hou = math.floor ( ( seconds % 86400 ) /3600 )
  42. local day = math.floor ( seconds /86400 )
  43.  
  44.  
  45. if day > 0 and day < 10 then table.insert( results, day .. ( day == 1 and " day" or " days" ) )
  46. elseif day > 0 then table.insert( results, day .. ( day == 1 and "" or "" ) ) end
  47.  
  48. if hou >= 1 and hou < 10 then table.insert( results, "0"..hou .. ( hou == 1 and "" or "" ) )
  49. elseif hou > 0 then table.insert( results, hou .. ( hou == 1 and "" or "" ) ) end
  50.  
  51. if min >= 0 and min < 10 then table.insert( results, "0"..min .. ( min == 1 and "" or "" ) )
  52. elseif min > 0 then table.insert( results, min .. ( hou == 1 and "" or "" ) ) end
  53.  
  54. if sec >= 0 and sec < 10 then table.insert( results, "0"..sec .. ( sec == 1 and "" or "" ) )
  55. elseif sec > 0 then table.insert( results, sec .. ( sec == 1 and "" or "" ) ) end
  56.  
  57. return string.reverse ( table.concat ( results, " : " ):reverse():gsub(" : ", " : ", 1 ) )
  58. end
  59. return ""
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement