• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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