SA-MP Forums Archive
A very petty string help. - 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: A very petty string help. (/showthread.php?tid=645007)



A very petty string help. - Ritzy2K - 18.11.2017

Okay, so I use multicolored string, but I want a particular word of a string to be the color of the player team.
Код:
{00FFFF}Notification: {FFFFFF}You Have Spawned as {FFFF00}%s'sSupport{FFFFFF}. Use {00FF00}/classhelp {FFFFFF}for more Information.");
I want to code it in such a way that %s's is the color of the team name how would I do that?


Re: A very petty string help. - Kraeror - 18.11.2017

Can You tell us the function for checking the player's color like GetPlayerTeamColor ? Do You have something like that?


Re: A very petty string help. - Ritzy2K - 18.11.2017

Um, let's say the function is called x
Whatever the function is, it will get the color. But how do I apply the color to a specific word in the string like I can with hex code?


Re: A very petty string help. - Dayrion - 18.11.2017

Quote:
Originally Posted by Ritzy
Посмотреть сообщение
Um, let's say the function is called x
Whatever the function is, it will get the color. But how do I apply the color to a specific word in the string like I can with hex code?
If your function return the color as the string, you can put it in your code like:
PHP код:
"blablabla {%s} blabla" 
If it's not a string but an integer or hex value, you should use 'x' specifier.
PHP код:
"blablabla {%06x} blabla" 



Re: A very petty string help. - Ritzy2K - 18.11.2017

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
If your function return the color as the string, you can put it in your code like:
PHP код:
"blablabla {%s} blabla" 
If it's not a string but an integer or hex value, you should use 'x' specifier.
PHP код:
"blablabla {%06x} blabla" 
Thank you, it was returning the color as integer and your method worked +rep'ed.