Jump to content

NameTags


#Paper

Recommended Posts

Posted

this is the script for make the tag name in race gm, how i can generate the tagname's color random?

  
local r,g,b = 255,127,36 
dxDrawText ( getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE,"default", "center", "bottom", false, false, false ) 
  

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

Posted

math.random(0,255) will return random value from 0-255 range

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

first - you have to store 3 colors for every player. so something like that will be needed:

  
-- server side!! 
addEventHandler("onPlayerJoin", getRootElement(), function() 
  local col = { math.random(0,255), math.random(0,255), math.random(0,255) } 
  setElementData(source, "color", col) 
end) 
  
-- then on drawing function (client): 
local col=getElementData(player, "color") 
local r=col[1] 
local g=col[2] 
local b=col[3] 
dxDrawText (getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE,"default", "center", "bottom", false, false, false ) 
  

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
first - you have to store 3 colors for every player. so something like that will be needed:
  
-- server side!! 
addEventHandler("onPlayerJoin", getRootElement(), function() 
  local col = { math.random(0,255), math.random(0,255), math.random(0,255) } 
  setElementData(source, "color", col) 
end) 
  
-- then on drawing function (client): 
local col=getElementData(player, "color") 
local r=col[1] 
local g=col[2] 
local b=col[3] 
dxDrawText (getPlayerName(player), sx, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE,"default", "center", "bottom", false, false, false ) 
  

ty varez! work! ^_^ YOU ARE PRO! xD

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

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