Jump to content

Why is the drawText all buggy?


Almeidowski

Recommended Posts

Hello. I'm trying to make this script where my coordinates are displayed near the radar. However, it's all buggy for some reason, as you can see in the image in the link:

https://imgur.com/cRm9eFK


What are all those weird shapes?

My code is as follows:

mp.events.add('render', () => {
    var x = String(mp.players.local.position.x)
    var y = String(mp.players.local.position.y)
    var z = String(mp.players.local.position.z)
    var tamanho = 5
    var xCortado = x.substring(0tamanho);
    var yCortado = y.substring(0tamanho);
    var zCortado = z.substring(0tamanho);
    mp.game.graphics.drawText('X: ' + xCortado + ' Y: ' + yCortado + ' Z: ' + zCortado, [0.20.8], { 
      font: 2
      color: [1972550230], 
      scale: [0.50.5], 
      outline: false
    });
});

It continues to bug if I don't add the last 4 variables.

mp.events.add('render', () => {
    var x = String(mp.players.local.position.x)
    var y = String(mp.players.local.position.y)
    var z = String(mp.players.local.position.z)
    mp.game.graphics.drawText('X: ' + x' Y: ' + y' Z: ' + z, [0.20.8], { 
      font: 2
      color: [1972550230], 
      scale: [0.50.5], 
      outline: false
    });
});

Why is the drawText showing up like this? How can I fix it?

@EDIT
I figured out that the full squares represent ' - ' (negative numbers) and the empty squares are ' . '

@EDIT2

The only problem was the font. I changed the font and it fixed 

Edited by Almeidowski
Link to comment
Share on other sites

mp.events.add('render', () => {


    var x = mp.players.local.position.x;


    var y = mp.players.local.position.y;


    var z = mp.players.local.position.z;


    mp.game.graphics.drawText('X: ' + x + ' Y: ' + y + ' Z: ' + z, [0.2, 0.8], { 


      font: 2, 


      color: [197, 255, 0, 230], 


      scale: [0.5, 0.5], 


      outline: false


    });


});

 

Link to comment
Share on other sites

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...