Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do pliku C:
- local start = getTickCount()
- function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
- if
- type( sEventName ) == 'string' and
- isElement( pElementAttachedTo ) and
- type( func ) == 'function'
- then
- local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
- if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
- for i, v in ipairs( aAttachedFunctions ) do
- if v == func then
- return true
- end
- end
- end
- end
- return false
- end
- foNte = dxCreateFont(":Sg_Buttony/font.ttf",9) or "defaul-bold"
- l={}
- function hud()
- x,y = guiGetScreenSize()
- screenW,screenH = guiGetScreenSize()
- for k,v in ipairs ( getElementsByType ( "object" ) ) do
- if getElementData ( v, "ogloszenie" ) then
- local tekst = getElementData ( v, "tekstogloszenia" )
- local width = dxGetTextWidth(tekst,1,"default-bold")
- local now = getTickCount()
- local endTime = start + 2000
- local elapsedTime = now - start
- local duration = endTime - start
- local progress = elapsedTime / duration
- if progress and progress > 4 then
- if not s then
- s = getTickCount()
- end
- local x, y, z = interpolateBetween (screenW * 0.3493, screenH * - 0.1000, 0, screenW * 0.3493, screenH * - 0.1000, 0, (s-getTickCount())/(( s + 2000 ) - s ), "OutBack")
- local xt, yt, zt = interpolateBetween (screenW * 0.3551, screenH * - 0.1000, 0,screenW * 0.3551, screenH * - 0.1000 , 0, (s-getTickCount())/(( s + 2000 ) - s ), "OutBack")
- roundedRectangle(x, y, screenW * 0.2941, screenH * 0.0859 + (width * 0.05), tocolor(0, 0, 0, 150),tocolor(0, 0, 0, 150), false)
- dxDrawText(tekst,xt, yt,screenW * 0.6382, screenH * 0.8555, tocolor(255,255,255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)
- return end
- local px, py, pz = getElementPosition(localPlayer)
- local x, y, z = interpolateBetween (screenW * 0.3493, screenH * - 0.1000, 0,screenW * 0.3493, screenH * 0.0100 , 0, progress, "OutBack")
- local xt, yt, zt = interpolateBetween (screenW * 0.3551, screenH * - 0.1000, 0,screenW * 0.3551, screenH * 0.0200 , 0, progress, "OutBack")
- roundedRectangle(x, y, screenW * 0.2941, screenH * 0.0859 + (width * 0.05), tocolor(0, 0, 0, 150), tocolor(0, 0, 0, 150), false)
- dxDrawText(tekst,xt, yt,screenW * 0.6382, screenH * 0.8555, tocolor(255,255,255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)
- end
- end
- end
- function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
- if (x and y and w and h) then
- if (not borderColor) then
- borderColor = tocolor(0, 0, 0, 200);
- end
- if (not bgColor) then
- bgColor = borderColor;
- end
- --> Background
- dxDrawRectangle(x, y, w, h, bgColor, postGUI);
- --> Border
- dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top
- dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom
- dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left
- dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right
- end
- end
- addEventHandler ( "onClientElementDataChange", root, function(data,old)
- if getElementType(source) == "object" and data == "ogloszenie" then
- if getElementData(source,"ogloszenie") then
- if isEventHandlerAdded("onClientRender",root,hud) then
- removeEventHandler ( "onClientRender", root, hud)
- end
- l={math.random(0,255),math.random(0,255),math.random(0,255)}
- czas = getTickCount()
- start = getTickCount()
- s = nil
- addEventHandler ( "onClientRender", root, hud)
- else
- removeEventHandler ( "onClientRender", root, hud)
- czas = getTickCount()
- start = getTickCount()
- s = nil
- l={}
- end
- end
- end)
- addEventHandler ( "onClientRender", root, hud)
- DO PLIKU S:
- local skrzyniaogloszen = createObject ( 980, 0,0, -100 )
- function ogloszenie ( source, cmd, ... )
- if not getElementData(source,"user:premium") then outputChatBox("* Brak uprawnień.",source,255,0,0) return end
- if ... then
- if not getElementData ( skrzyniaogloszen, "ogloszenie" ) then
- local text = table.concat({...}, " " )
- setElementData ( skrzyniaogloszen, "ogloszenie", true )
- setElementData ( skrzyniaogloszen, "tekstogloszenia","[Premium] "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." ["..getElementData ( source, "id").."] : \n "..text.." ")
- setTimer ( setElementData, 10000,1, skrzyniaogloszen, "ogloszenie", false )
- else
- outputChatBox("* Ogłoszenia mogą być nadawane minimum 10 sekund.", source, 255, 0, 0, true )
- end
- else
- outputChatBox("Aby nadać ogłoszenie /ogloszenie [tresc] .", source, 255, 96, 0, true )
- end
- end
- addCommandHandler("ogloszenie", ogloszenie)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement