bandi94 Posted February 26, 2012 Share Posted February 26, 2012 1. i edited the race nametag's to draw color text (hex color codes in the name ) now my problem is if i put it in the race/nametags.lua then its not working bk in the race gamemode for getPlayerName it's return the name whitout hex code's if i delet the race/nametags.lua and i run my nametags in a resource then its work's but it draw that old nametag's like in "play" gamemode now my question how can i get "getPlayerName" whit hex code's in race gamemode or how can i disable that old nametag's to be showed only the my nametag's thx 2. i am searching for the text on the map end "Vote for next map starts in .. " now i searched and i found that (i think) it's inside of "RaceMode.endMap()" but i don;t find where is the "endMap()" function if somebody know ? i wanna edit the text color and font thx Link to comment
drk Posted February 26, 2012 Share Posted February 26, 2012 For first question, show nametags.lua. To get player name and show with colors use my edited dxDrawColorText: function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end For second question, search in modes/destructionderby.lua. If you don't find anything in Destruction derby see the other modes. Link to comment
bandi94 Posted February 26, 2012 Author Share Posted February 26, 2012 Draken i know about this color drawing i use this my problem is when i use in the race gamemode : getPlayerName it return |DGT|Puma if i use getPlayerNAme in another resource it return |DGT|#00ff00Puma my problem is that in the race gamemode getPlayerName return the name whitout hex color's Link to comment
TAPL Posted February 26, 2012 Share Posted February 26, 2012 in race resource open the file (_common.lua) and remove line 81 and 82 and 83 and 84 done. Link to comment
bandi94 Posted February 26, 2012 Author Share Posted February 26, 2012 thx i found a way to make happy both sides race,nametag's i editet the _common.lua and if i ask getPlayerName(player) it return whitout color code's for race don't show in the rankboard and list the color codes if i ask getPlayerName(player,"hex") then it return whit the hex code Link to comment
Kenix Posted February 26, 2012 Share Posted February 26, 2012 _getPlayerName = getPlayerName function getPlayerName( el ) if isElement( el ) then local name = _getPlayerName( el ) if name then return name:gsub ( '#%x%x%x%x%x%x', '' ) or name end return false end return false end ? Link to comment
bandi94 Posted February 26, 2012 Author Share Posted February 26, 2012 function removeColorCoding ( name ) return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name end _getPlayerName = getPlayerName function getPlayerName ( player,hex ) if hex then return _getPlayerName ( player ) else return removeColorCoding ( _getPlayerName ( player ) ) end end Link to comment
Kenix Posted February 26, 2012 Share Posted February 26, 2012 _getPlayerName = getPlayerName function getPlayerName ( plr,removeHex ) if isElement( plr ) then if removeHex then local name = _getPlayerName( plr ) return name:gsub ( '#%x%x%x%x%x%x', '' ) or name end return _getPlayerName( plr ) end return false end What you mean i not understand ... Remove hex only? string getPlayerName ( player plr,[ bool removeHex ] ) Link to comment
bandi94 Posted February 27, 2012 Author Share Posted February 27, 2012 Kenix that scipt is my edited script the race return teh Name whitout the hex color code and my namrtag's need the hex color and then i make that scpit that if in racegamemod if i use getPlayerNAme(player,"hex") then it return the name whit hex color i post that scipt bk if somebody have this problem to then they can use my code i don't need help anymore bk i make it work but thx Link to comment
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