Using team color in a textdraw
#1

I have a string like this:
pawn Код:
format(string, sizeof(string), "< PRIVATE "COLOR_WHITE"CLASS >");
I am going to use the string in a texdraw. I want the word: "PRIVATE" to be in that player's team color. I got a stock "TeamColor" to get the team's color, so can I use it in that somehow? I dont want format these manually (like if(gTeam[playerid] == TEAMNAME)) because I got 4 teams and 6 classes so I'd have to make 24 seperate format lines. Any help would be appreciated.
Reply
#2

Not possible in textdraw. You can only color words in a sentence using ~r~, ~g~, etc. Or you would have to create a separate textdraw for the word you want to color (TextDrawColor).
Reply
#3

Also, you cant set the text colour in a text draw past the 255th character (https://sampwiki.blast.hk/wiki/TextDrawCreate)

So use a for loop, to have a text draw PER team.
Reply
#4

Oh yes, I forgot that I can use only ~r~ ~w~ and these in textdraws. But how should I do it then?

I have 4 teams (colors: green, red, yellow, purple). How to show "PRIVATE" in seperate color for each team then?
pawn Код:
format(string, sizeof(string), "< PRIVATE ~w~CLASS >");
Reply
#5

I figured it out:
pawn Код:
if(gTeam[playerid] == T_ENGLAND) teamcolor = ("g");
and:
pawn Код:
format(string, sizeof(string), "< ~%s~PRIVATE ~w~CLASS >", teamcolor);
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)