Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sx, sy = guiGetScreenSize ()
- function notify(x, y, w, h, Title, text, fadeTime)
- local sx, sy = guiGetScreenSize()
- local tempTextTable = {}
- local tempText = ""
- local isShowing = false;
- local Alpha = 255;
- local Alpha2 = 180;
- for token in string.gmatch(text, ".") do
- table.insert(tempTextTable, token)
- end
- local int = 0;
- for k,v in pairs(tempTextTable) do
- if ( string.len(tempText) * 10 > w ) then
- if ( int == 0 ) then
- tempText = tempText .. "\n"
- int = 1;
- end
- end
- tempText = tempText .. v;
- end
- local notify = {
- draw = function ()
- dxDrawRectangle( x, y, w, h, tocolor(0, 0, 0, Alpha2) ) -- main
- dxDrawText(Title, x + 10, y + 5, 0, 0, tocolor( 255, 0, 0, Alpha ), 2) -- title
- dxDrawLine( x, y+h, w +x, y+h, tocolor( 255, 255, 255, Alpha ), 2 ) -- outside
- dxDrawLine( x, y, w +x, y, tocolor( 255, 255, 255, Alpha ), 2 ) -- outside
- dxDrawLine( x, y, x, y + h, tocolor( 255, 255, 255, Alpha ), 2 ) -- outside
- dxDrawLine( x, y + 40, w +x, y + 40, tocolor( 255, 255, 255, Alpha ), 2 ) -- x
- --outputChatBox(string.len(text) .. ", " .. w)
- dxDrawText(text, x + 5, y + 45, 0, 0, tocolor(231, 76, 60, Alpha), 1.5) -- text
- end,
- update = function ()
- if ( x > sx ) then
- --removeEventHandler( "onClientRender", getRootElement(), update )
- isShowing = false;
- else
- y = y + 10;
- end
- end,
- isOn = function ()
- return isShowing;
- end
- }
- function create ()
- addEventHandler( "onClientRender", getRootElement(), notify.draw )
- isShowing = true;
- setTimer(
- function ()
- addEventHandler( "onClientRender", getRootElement(), notify.update )
- end,
- fadeTime * 1000, 1)
- return notify;
- end
- return create();
- end
- function ntoX( Title, text, fadeOut )
- notify(sx - 300, 0, 300, 100, Title, text, fadeOut)
- end
- addEvent( "notify", true )
- addEventHandler( "notify", getRootElement(),
- function ( Title, text, fadeIn )
- ntoX(Title, text, fadeIn)
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement