Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. --[[
  2.     autor: Pat
  3.     Nie zezwalam na używanie skryptu bez mojej zgody
  4.     kontakt: igormeger@gmail.com
  5. ]]
  6.  
  7. local texts={}
  8.  
  9. local prepared_text =function(text,x,y,w,h,color,font)
  10.     dxDrawText(text,x,y,w+x,h+y,color,1,dxGetFont(font),"center","center",true,true,true,false,false)
  11. end
  12.  
  13. addEventHandler('onClientRender',root,function()
  14.     for i,v in ipairs(texts) do
  15.         if v['visible'] then
  16.             local text = v['text']
  17.             local x,y,w,h = v['pos']['x'],v['pos']['y'],v['pos']['w'],v['pos']['h']
  18.             local color = v['color']
  19.             local font = v['font']
  20.             prepared_text(text, x,y,w,h, color, font)
  21.         end
  22.     end
  23. end)
  24.  
  25. dxCreateText=function(text,x,y,w,h,color,font)
  26.     table.insert(texts, {
  27.         ['text']=text,
  28.         ['pos']={
  29.             ['x']=x,
  30.             ['y']=y,
  31.             ['w']=w,
  32.             ['h']=h,
  33.         },
  34.         ['color']=color,
  35.         ['font']=font,
  36.         ['visible']=true,
  37.     })
  38.     return #texts
  39. end
  40.  
  41. dxTextSetColor=function(textid,color)
  42.     for i,v in ipairs(texts) do
  43.         if i == textid then
  44.             v['color']=color
  45.         end
  46.     end
  47. end
  48.  
  49. dxTextSetVisible=function(textid,bool)
  50.     for i,v in ipairs(texts) do
  51.         if i == textid then
  52.             v['visible']=bool
  53.         end
  54.     end
  55. end
  56.  
  57.  
  58. dxTextSetPosition=function(textid,x,y,w,h)
  59.     for i,v in ipairs(texts) do
  60.         if i == textid then
  61.             v['pos']={
  62.                 ['x']=x,
  63.                 ['y']=y,
  64.                 ['w']=w,
  65.                 ['h']=h,
  66.             }
  67.         end
  68.     end
  69. end
  70.  
  71. dxDestroyText=function(textID)
  72.     table.remove(texts,textID)
  73. end
  74.  
  75. dxTextSetString=function(textID,textString)
  76.     for i,v in ipairs(texts) do
  77.         if i==textID then
  78.             v['text']=textString
  79.         end
  80.     end
  81. end
  82.  
  83. --[[
  84. local text = dxCreateText('sima',0,0,1000,25,tocolor(255,255,255,255),'default-bold')
  85. dxTextSetString(text, 'sima v2' )]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement