Jump to content

Recommended Posts

Posted (edited)

Hello Everyone,

Have you ever been bothered by the notifications that is in front of the mini-map? Is it to small for people to see it? Well today I have the solution for you!

Today i'll present to you the Dx-bar messages.

Dx-bar messages are 2 bars on the top of your screen and the bottom of your screen. You can use them to send notifications for anybody you want and its pretty easy to use!.

yGDpBKk.png

 

unknown.png

Source:

Spoiler

const maxMessages = 5; // The max messages that will show (on each bar)
const DefaultTime = 8; // The max time each message will show if time isn't defined.
const DefaultPos = 'top'; // Default position if not specified in calling the function.
const top = []; // Top Bar 
const bot = []; // Bottom Bar

mp.events.add('Createinfo', (msg, r, g, b, pos) => { // Event that will be global to call
    if (!msg) return false; // No message? No bar!
    if (pos == undefined) pos = DefaultPos;
    let data = { // Gathering Data to push to the bar
        text: msg,
        r: r,
        g: g,
        b: b,
        position: pos
    };
    if (pos.toLowerCase() === 'top') { // Sending data to Top
        top.push(data);
        setTimeout(_ => { // After 8 seconds, the message will be deleted
            if (top.includes(data)) top.splice(top.indexOf(data), 1)
        }, DefaultTime * 1000)
    } else if (pos.toLowerCase() === 'bot') { // Sending data to bot
        bot.push(data)
        setTimeout(_ => { // After 8 seconds, the message will be deleted
            if (bot.includes(data)) bot.splice(bot.indexOf(data), 1)
        }, DefaultTime * 1000)
    }
})

function renderbar() {

    if (top.length > 7) top.splice(0, 1) // if the messages are more than 7, Delete the first message.
    if (bot.length > 7) bot.splice(0, 1)

    for (let i in top) { // Top bar manager
        const margin = 0.01;
        const x = 0.5;
        const y = (0.03 + margin) * i; // Bar coordination management
        mp.game.graphics.drawRect(x, y + 0.01, 0.5, 0.040, 0, 0, 0, 200)
        mp.game.graphics.drawText(top[i].text, 0, [top[i].r, top[i].g, top[i].b, 185], 0.3, 0.3, false, x, y)
    }

    for (let z in bot) { // Bot bar manager
        const margin_ = 0.03;
        const x_ = 0.5;
        let y_ = 0.96 - margin_ * z // Bar coordination management
        mp.game.graphics.drawRect(x_, y_, 0.5, 0.030, 0, 0, 0, 200);
        mp.game.graphics.drawText(bot[z].text, 0, [bot[z].r, bot[z].g, bot[z].b, 185], 0.3, 0.3, true, x_, y_ - 0.01);
    }
}

mp.events.add('render', renderbar); // Drawing the bar on each frame event.

 

Bar Creation:

//Server-side

player.call('Createinfo', '<text>', R, G, B, 'top or bot')

//Client-side

mp.game.call('Createinfo', '<text>', R, G, B, 'top or bot')

 

Here is the download

 

I wish you enjoy resource. Feel free to report any bugs.

 

Feel free to edit, use, or copy the resource, but don't forget the credits ;) .

Thanks for watching,
Best Regards,
Captien

Edited by Captien
Improved Top bar coordination
  • Like 2
Posted (edited)

Well it still needs some improvements, i'll be updating it time by time to make it "Sexier".

Ps: Added a Horny Gurl for Sexuality, and Improved Top bar Management.

Edited by Captien
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...