JASS:
library GetPlayerColorString
//Credits to Andrewgosu, Silvenon, PurgeAndFire111 for the script
globals
private string array str
endglobals
function GetPlayerColorString takes player p returns string
return str[GetHandleId(GetPlayerColor(p))]
endfunction
function GetPlayerColorText takes player p, string s returns string
return GetPlayerColorString(p) + s + "|r"
endfunction
function GetPlayerNameColored takes player p returns string
return GetPlayerColorText(p, GetPlayerName(p))
endfunction
private module M
static method onInit takes nothing returns nothing
set str[0] = "|cffFF0202"
set str[1] = "|cff0041FF"
set str[2] = "|cff1BE5B8"
set str[3] = "|cff530080"
set str[4] = "|cffFFFC00"
set str[5] = "|cffFE890D"
set str[6] = "|cff1FBF00"
set str[7] = "|cffE45AAF"
set str[8] = "|cff949596"
set str[9] = "|cff7DBEF1"
set str[10] = "|cff0F6145"
set str[11] = "|cff4D2903"
endmethod
endmodule
private struct S
implement M
endstruct
endlibrary
JASS:
call BJDebugMsg(GetPlayerColorText(p, GetPlayerName(p) + " this is orange text!"))
It'll display this:
Player 5 (Orange) this is orange text!
Credit to PurgeAndFire for the colour scripts.
The function returns the players name coloured, according to what colour he/she is. It does not return the color based on what playerslot the player is in, and is compatible with changing player colors.
- Kixer
Updated:
Fixed the colours using a program called Chaos Spectrum by Fougie47, hopefully they are correct now.
The playercolor pc is nulled because it is a handle.
Updated:
Now uses the colour codes that have been suggested as they seem to be correct.
*Updated*
Updated once and for all by Bribe for much better performance.
Last edited by a moderator: