Jump to content

fast question


bandi94

Recommended Posts

Posted

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

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

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.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

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

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

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 :D

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted
_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 

?

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
  
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 

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted
_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 ] ) 
  

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

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

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

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