• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Color(ed) (Player) Names

Status
Not open for further replies.
Level 2
Joined
Aug 1, 2008
Messages
6
Okay, so I always play games and stuff, and when it has a text that has a player name, It says like, "Player name" just got owned by "player name", and the player name is in their team color...I know that you need variables and stuff, but I don't get it, so when I have my text it says it with just white... Can you try and explain how to do it? Thanks. :cute:
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
JASS:
function PlayerColor takes playercolor color returns string
    if ( color == PLAYER_COLOR_RED ) then
        return "|c00FF0000"
    endif
    if ( color == PLAYER_COLOR_BLUE ) then
        return "|c000000FF"
    endif
    if ( color == PLAYER_COLOR_CYAN ) then
        return "|c0040E0D0"
    endif
    if ( color == PLAYER_COLOR_PURPLE ) then
        return "|c00A020F0"
    endif
    if ( color == PLAYER_COLOR_YELLOW ) then
        return "|c00FFFF00"
    endif
    if ( color == PLAYER_COLOR_ORANGE ) then
        return "|c00FFA500"
    endif
    if ( color == PLAYER_COLOR_GREEN ) then
        return "|c0000FF00"
    endif
    if ( color == PLAYER_COLOR_PINK ) then
        return "|c00FFC0CB"
    endif
    if ( color == PLAYER_COLOR_LIGHT_GRAY ) then
        return "|c00BEBEBE"
    endif
    if ( color == PLAYER_COLOR_LIGHT_BLUE ) then
        return "|c00ADD8E6"
    endif
    if ( color == PLAYER_COLOR_AQUA ) then
        return "|c00006400"
    endif
    if ( color == PLAYER_COLOR_BROWN ) then
        return "|c00A52A2A"
    endif
    return "|c00000000"
endfunction

usage:
JASS:
call DisplayTextToPlayer(player, 0, 0, PlayerColor(GetPlayerColor(GetOwningPlayer(GetDyingUnit()))) + GetPlayerName(GetOwningPlayer(GetDyingUnit())) + " just got owned")
 
Status
Not open for further replies.
Top