
Dzejki
Members-
Posts
17 -
Joined
-
Last visited
Dzejki's Achievements

Square (6/54)
0
Reputation
-
Couse you have to do this script on server-side. Client-side is only for you - client who called the function/event.
-
2nd one is possible to do. Just use DX functions.
-
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.
-
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
-
I can't see any mistake. Make sure that your clientside script is included in meta.
-
https://wiki.multitheftauto.com/wiki/Is ... rBoxActive
-
No problem, have fun with scripting
-
add before addEventHandler("timeHud", getRootElement(), timeHudF) this addEvent("timeHud", true)
-
timeHud event doesn't work, check code for it.
-
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