#Paper Posted October 20, 2010 Posted October 20, 2010 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 ) My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
dzek (varez) Posted October 20, 2010 Posted October 20, 2010 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)!
#Paper Posted October 20, 2010 Author Posted October 20, 2010 math.random(0,255) will return random value from 0-255 range can you post the modified string? pls? My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
dzek (varez) Posted October 20, 2010 Posted October 20, 2010 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)!
#Paper Posted October 21, 2010 Author Posted October 21, 2010 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! My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now