Jump to content

Dzejki

Members
  • Posts

    17
  • Joined

  • Last visited

Dzejki's Achievements

Square

Square (6/54)

0

Reputation

  1. Couse you have to do this script on server-side. Client-side is only for you - client who called the function/event.
  2. Dzejki

    Label

    I think you don't understand me. I dont wan't text on one line but I want automatic enter if text is at the end of label. How I can use this fucntion to do sth like that?
  3. Dzejki

    Label

    I want to know if it is possible to do text wrapping. I mean like wordBreak option in DX https://wiki.multitheftauto.com/wiki/DxDrawText But I want to do this option in guiLabel, is it possible?
  4. Dzejki

    Excel in MTA

    2nd one is possible to do. Just use DX functions.
  5. Dzejki

    Notifications

    You meant table.remove(k)? I'll check it. @Edit: Nah, i don't understand. My worst side is tables nad I don't understand it at all.
  6. Dzejki

    Notifications

    setTimer( function () for k,v in ipairs(info) do if k == 1 then alpha(info[1], 0.7, 0, 0.3) else local x, y = guiGetPosition(v, false) info[1] = info[2] info[2] = info[3] move(v, x, y, x, y + (50 * k), 0.5) end end end , 3000, 1) I did sth like this but every notifications moving down, the oldest doesn't disappear. They all moving and changing alpha same time. Other problem is that each notfication's position is higher and higher, it looks like this: http://snag.gy/awQll.jpg Full code: function showInfo (type, text) if type and text then local path, path_ if type == "warning" then path, path_ = "images/info_r.png", "images/warning.png" elseif type == "info" then path, path_ = "images/info_g.png", "images/info.png" end local y = 50 if #info > 1 then y = #info * 50 else y = 50 end info[#info + 1] = guiCreateStaticImage(((screen_x - (screen_x * 0.5))/2) - 20, screen_y - y, screen_x * 0.5, 35, path, false) guiCreateStaticImage((screen_x * 0.5) * 0.1, 5, 25, 25, path_, false, info[#info + 1]) guiSetAlpha(info[#info + 1], 0.7) local label = guiCreateLabel(((screen_x * 0.5) * 0.1) + 35, 10, (screen_x * 0.5) - (((screen_x * 0.5) * 0.1) + 35), 35, text, false, info[#info + 1]) guiSetFont(label, guiCreateFont("fonts/Idealist.ttf", 12)) move(info[#info + 1], ((screen_x - (screen_x * 0.5))/2) - 20, screen_y - 50, (screen_x - (screen_x * 0.5))/2, screen_y - 50, 2) setTimer( function () for k,v in ipairs(info) do if k == 1 then alpha(info[1], 0.7, 0, 0.3) else local x, y = guiGetPosition(v, false) info[1] = info[2] info[2] = info[3] move(v, x, y, x, y + (50 * k), 0.5) end end end , 3000, 1) end end
  7. Dzejki

    Notifications

    How I can define this array?
  8. I can't see any mistake. Make sure that your clientside script is included in meta.
  9. https://wiki.multitheftauto.com/wiki/Is ... rBoxActive
  10. No problem, have fun with scripting
  11. add before addEventHandler("timeHud", getRootElement(), timeHudF) this addEvent("timeHud", true)
  12. timeHud event doesn't work, check code for it.
  13. Dzejki

    Notifications

    Hello guys. I just want to know how i can do such a thing: If someone spamming with call notification function I want to change next notification position. I don't want them all in same position. And when the oldest notification disappears, rest changing position. How can I do that? local screen_x, screen_y = guiGetScreenSize() local info = {} function showInfo (type, text) if type and text then local path, path_ if type == "warning" then path, path_ = "images/info_r.png", "images/warning.png" elseif type == "info" then path, path_ = "images/info_g.png", "images/info.png" end local y = 50 if #info > 1 then y = #info * 50 else y = 50 end info[#info + 1] = guiCreateStaticImage(((screen_x - (screen_x * 0.5))/2) - 20, screen_y - y, screen_x * 0.5, 35, path, false) guiCreateStaticImage((screen_x * 0.5) * 0.1, 5, 25, 25, path_, false, info[#info + 1]) guiSetAlpha(info[#info + 1], 0.7) local label = guiCreateLabel(((screen_x * 0.5) * 0.1) + 35, 10, (screen_x * 0.5) - (((screen_x * 0.5) * 0.1) + 35), 35, text, false, info[#info + 1]) guiSetFont(label, guiCreateFont("fonts/Idealist.ttf", 12)) move(info[#info + 1], ((screen_x - (screen_x * 0.5))/2) - 20, screen_y - 50, (screen_x - (screen_x * 0.5))/2, screen_y - 50, 2) setTimer( function () for k,v in ipairs(info) do if v == info[1] then alpha(info[1], 0.7, 0, 0.3) else local x, y = guiGetPosition(v, false) info[1] = info[2] info[2] = info[3] info[3] = nil move(v, x, y, x, y - 50, 0.5) end end end , 3000, 1) end end I did sth like that but I think that my thinking going bad way. And all code I did has no sense. But anyway, help me, please. Ah, and move and alpha functions look like this (they r working good): function move(guiElement, posx, posy, newx, newy, interpTime) if guiElement then if posx and posy and newx and newy then local startTick = getTickCount() interpTime = interpTime * 1000 addEventHandler("onClientRender", root, function() local currTime = getTickCount() - startTick local progress = currTime / interpTime if progress <= 1 then local interpPosX, interpPosY = interpolateBetween(posx, posy, 0, newx, newy, 0, progress, "OutBack", 0, 0, 1) guiSetPosition(guiElement, interpPosX, interpPosY, false) end end) end end end function alpha(guiElement, interpStart, interpStop, interpTime) if guiElement then local startTick = getTickCount() interpTime = interpTime * 1000 addEventHandler("onClientRender", root, function() local currTime = getTickCount() - startTick local progress = currTime / interpTime if progress <= 1 then local interpAlpha = interpolateBetween(interpStart, 0, 0, interpStop, 0, 0, progress, "Linear") guiSetAlpha(guiElement,interpAlpha) end end) end end
×
×
  • Create New...