Jump to content

Search the Community

Showing results for tags 'notifications'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 2 results

  1. Hi guys I was in need of some notifications in my car-dealership script, so I decided to split up the functionality and share this resource as well. These notifications aren't very special but can be very useful for displaying errors or information, they stack underneath each other and can be removed manually or automatically. Visual Example List of Functions (client) add: adds a notification with given parameters exports["simple-notifications"]:add("Hello world!", 7000, 220, tocolor(255, 255, 255), tocolor(0, 155, 0, 155)); add(text[, delay, fade, textColor, bgColor]) text: text to display (string) delay (optional): time to stay active in milliseconds (number) default: 7000 fade (optional): time for the fade out animation in milliseconds (number) default: 220 textColor (optional): color of the text (tocolor) default: tocolor(255, 255, 255) bgColor (optional): background color of the text (tocolor) default: tocolor(0, 0, 0, 155) return index (number) shift: removes the first notification exports["simple-notifications"]:shift(); pop: removes the last notification exports["simple-notifications"]:pop(); remove: removes a notification by index remove(idx[, instant]) idx: the index returned from the add function (number) instant: remove the notification without fade (boolean) default: false List of Functions (server) All client side functions are shared, but they take an extra first argument playerSource, example: exports["simple-notifications"]:add(source, "Hello world!", 7000, 220, tocolor(255, 255, 255), tocolor(0, 155, 0, 155)); Download https://community.multitheftauto.com/index.php?p=resources&s=details&id=18339 Leave any questions or feedback below and I'll see if I add it. Viruz out!
  2. Hey, so, I would like to make a GTA like (it sounds strange) notification system, something like you can see in every singleplayer GTA, the upper left hand corner box notifications: I have the base script, everything renders and works fine, but I would like to make a special "timer" for it, which works like the following way: the longer the text is, the longer the notification lasts. This is one thing I would like to make, the other thing is: how is it possibble to make an export function for this, so I can make notifications from other resources with the text I give in the resource I'm calling it back from. I don't really understand tables and loops, I would be so happy if somebody could help me! I hope you can understand me, and what I am trying to do and explain, thanks for the help in advance! local displayWidth, displayHeight = guiGetScreenSize(); local borderDistance = 20 local tipBox = { string = "asfasfasafaasfasfasafsafsfasfasafsasfasfafsafssafasfsdwadsadwqwdasdasfasasafsaf" } local boxX, boxY = borderDistance * displayWidth / displayWidth, borderDistance * displayHeight / displayHeight local boxPadding = 10 local lineHeight = dxGetFontHeight( 1, "default-bold" ) local minimumWidth = 350 local offsetWidth = 25 addEventHandler( "onClientRender", root, function( ) local lines = 0 local wordbreak = false local lineWidth = dxGetTextWidth( tipBox.string, 1, "default-bold" ) while ( lineWidth + offsetWidth > minimumWidth ) do lineWidth = lineWidth - minimumWidth lines = lines + 1 wordbreak = true end local boxWidth, boxHeight = minimumWidth + ( boxPadding * 3 ), ( lineHeight * ( lines + 1 ) ) + ( boxPadding * 2 ) dxDrawRectangle( boxX, boxY, boxWidth, boxHeight, tocolor( 0, 0, 0, 180 ), true ) dxDrawRectangle( boxX, boxY+boxHeight, boxWidth, 4, tocolor( 200, 0, 100, 255 ), true ) local textX, textY = boxX + boxPadding, boxY + boxPadding local textWidth, textHeight = textX + minimumWidth + boxPadding, textY + lineHeight + boxPadding dxDrawText( tipBox.string, textX, textY, textWidth, textHeight, tocolor( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, wordbreak, true ) end )
×
×
  • Create New...