Textdraw Color Different for each player
#1

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
Reply
#2

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;

Reply
#3

Unidentified ShowFactionTextDraw how do i identify him ?
Reply
#4

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

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);
Reply
#6

Not working... still grey
Reply
#7

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
Reply
#8

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

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).
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)