SA-MP Forums Archive
Using team color in a textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using team color in a textdraw (/showthread.php?tid=370242)



Using team color in a textdraw - Dan. - 19.08.2012

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.


Re: Using team color in a textdraw - Vince - 19.08.2012

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


Re: Using team color in a textdraw - Grimrandomer - 19.08.2012

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.


Re: Using team color in a textdraw - Dan. - 19.08.2012

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 >");



Re: Using team color in a textdraw - Dan. - 19.08.2012

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