Jump to content

Please help


Recommended Posts

Posted (edited)

Hey guys how to add palyerColor and playerName to dxDrawText ? i tried this codes but not working

function text (player, cmd)
        local name = getPlayerName(player)
        local r,g,b = getPlayerNametagColor (player)
  etc...
  ....

and here is the dxDrawText

        dxDrawText(""..name.." text", r, g, b, screenW * 0.2291, screenH * 0.1966, screenW * 0.7716, screenH * 0.2552, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false)

also i removed the " playerColor r, g, b, "

i got this msg:

ERROR: attempt to concatenate local 'name' (a boolean value)

Edited by Snakegold
Posted
local gPName = getPlayerName(getLocalPlayer())
dxDrawText(gPName.." text", screenW * 0.2291, screenH * 0.1966, screenW * 0.7716, screenH * 0.2552, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, true, false)

 

? DID I HELP YOU? 

Tsd6e1t.png

________________________________________________________________________

ム MY STEAM

76561198321211115.png

________________________________________________________________________

? MY SITE

cGejgxz.png

www.tommy.br.com

Posted
        local name = getPlayerName(localPlayer) 
local r, g, b = getPlayerNametagColor(localPlayer) 
dxDrawText(""..name.." text", screenW * 0.2291, screenH * 0.1966, screenW * 0.7716, screenH * 0.2552, tocolor(r , g , b , 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false)

 

 

 

  • Moderators
Posted
Just now, Snakegold said:

Bro why dxDrawtext appears only to me not everyone????

Because each computer is processing the same code. And localPlayer/getLocalPlayer() is used to get the player that is being controlled.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
2 minutes ago, Snakegold said:

i want when i do the command or someone do it , everyone can see it , how?

Learn first what a element, table and a loop is.

 

After that I will provide you with examples, because else you will not understand the code.

https://wiki.multitheftauto.com/wiki/Element

https://www.lua.org/pil/2.5.html

https://www.lua.org/pil/4.3.5.html

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

If you say so, then ok here you are:

 

local players = getElementsByType ("player", root, true)

for i=1, #players do
	local player = players[i]
	-- do your thing
end

 

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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