SA-MP Forums Archive
Textdraw Color Different for each player - 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: Textdraw Color Different for each player (/showthread.php?tid=596042)



Textdraw Color Different for each player - AlexuTzVs - 11.12.2015

I have a question , how can i make if a player is Civillian the TextDraw Color under the map is GREY and when he is PD or other faction is Blue or something else

Код:
    TextDrawShowForPlayer(playerid, Textdraw0);
    if(PlayerInfo[playerid][pMember] < 1 || PlayerInfo[playerid][pLeader] < 1)
        {
        TextDrawColor(Textdraw0, COLOR_GREY);
        }
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
        TextDrawColor(Textdraw0, 0x1732E8FF);
        }


This is what i've tried to do but it will show me GREY


Re: Textdraw Color Different for each player - TwinkiDaBoss - 11.12.2015

Use switches, they are quite faster.
PHP код:
ShowFactionTextDraw(playerid) {
    switch(
PlayerInfo[playerid][pMember]) {
        case 
1TextDrawColor(Textdraw00x1732E8FF); //if PlayerInfo[playerid][pMember] is 1
        
default: TextDrawColor(Textdraw0COLOR_GREY); //if its any other number (if not 1)
    
}
    return 
true;




Re: Textdraw Color Different for each player - AlexuTzVs - 11.12.2015

Unidentified ShowFactionTextDraw how do i identify him ?


Re: Textdraw Color Different for each player - PrO.GameR - 11.12.2015

You should change your textdraws to playertextdraws first, then change the color depending on what team they are in


Re: Textdraw Color Different for each player - Gammix - 12.12.2015

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
You should change your textdraws to playertextdraws first, then change the color depending on what team they are in
You only require PlayerTextDraw when the strings are different else everything else can be done with Global.

OT:
Use TextDrawShowForPlayer after setting the color.
pawn Код:
if(PlayerInfo[playerid][pMember] < 1 || PlayerInfo[playerid][pLeader] < 1)
        {
        TextDrawColor(Textdraw0, COLOR_GREY);
        }
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
        TextDrawColor(Textdraw0, 0x1732E8FF);
        }
    TextDrawShowForPlayer(playerid, Textdraw0);



Re: Textdraw Color Different for each player - AlexuTzVs - 12.12.2015

Not working... still grey


Re: Textdraw Color Different for each player - PrO.GameR - 12.12.2015

Quote:
Originally Posted by Gammix
Посмотреть сообщение
You only require PlayerTextDraw when the strings are different else everything else can be done with Global.

OT:
Use TextDrawShowForPlayer after setting the color.
pawn Код:
if(PlayerInfo[playerid][pMember] < 1 || PlayerInfo[playerid][pLeader] < 1)
        {
        TextDrawColor(Textdraw0, COLOR_GREY);
        }
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
        TextDrawColor(Textdraw0, 0x1732E8FF);
        }
    TextDrawShowForPlayer(playerid, Textdraw0);
It "can" be done, but doesn't mean it should, having 1 textdraw, changing it's color to a couple of them isn't wise, if you really want to be efficient you should create 1 TD for each team then show one that is the player's team

with changing color then showing it to player he probably needs to change the color everytime a player joins/changes team, as far as I know it's way less efficient than having 2-3 textdraws with different colors

OT: either make one TD for each team, or use playertextdraws


Re: Textdraw Color Different for each player - AlexuTzVs - 12.12.2015

Oh you are so smart man , i will create TD for each teams i think it's easier really ty


Re: Textdraw Color Different for each player - JaKe Elite - 12.12.2015

Instead of making a textdraw for each team. You could've make the textdraw into Textdraw per Player in that way, You won't be wasting your time creating a team, let's just say you added more team (You'll have to add textdraws too).


Re: Textdraw Color Different for each player - AlexuTzVs - 12.12.2015

But honestly idk how to do that so for me is easier to make a td for each team ... 13 team np )