SA-MP Forums Archive
Dosent Set player to team color - 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: Dosent Set player to team color (/showthread.php?tid=477332)



Dosent Set player to team color - DarkLored - 23.11.2013

Hello i made the team color
and it worked for a while fine but then it dosent set the player to the team color the team civi dosent get his color
the team cop gets his color as i setted it

here is my code
pawn Код:
public SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == Team_Cop)
    {
        SetPlayerColor(playerid, COLOR_BLUE);
    }
    if(gTeam[playerid] == Team_Civi && gTeam[playerid] == Team_Rape && gTeam[playerid] == Team_Kidnapper)
    {
        SetPlayerColor(playerid, -1);
    }
    return 1;
}



Re: Dosent Set player to team color - Patrick - 23.11.2013

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
Hello i made the team color
and it worked for a while fine but then it dosent set the player to the team color the team civi dosent get his color
the team cop gets his color as i setted it

here is my code
pawn Код:
public SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == Team_Cop)
    {
        SetPlayerColor(playerid, COLOR_BLUE);
    }
    if(gTeam[playerid] == Team_Civi && gTeam[playerid] == Team_Rape && gTeam[playerid] == Team_Kidnapper)
    {
        SetPlayerColor(playerid, -1);
    }
    return 1;
}
SetPlayerColor must be a hex or decimal notation change -1 to 0xFFFFFFFF

/do You would hear pds2k12 sighing
Код:
This forum requires that you wait 240 seconds between posts. Please try again in 54 seconds.



Re: Dosent Set player to team color - DarkLored - 23.11.2013

NVM YOU WERE RIGHT REPED +1


Re: Dosent Set player to team color - Dragonsaurus - 23.11.2013

pawn Код:
public SetPlayerToTeamColor(playerid)
{
    if(gTeam[playerid] == Team_Cop)
    {
        SetPlayerColor(playerid, COLOR_BLUE);
    }
    if(gTeam[playerid] == Team_Civi || gTeam[playerid] == Team_Rape || gTeam[playerid] == Team_Kidnapper)
    {
        SetPlayerColor(playerid, 0xFFFFFFFF);
    }
    return 1;
}
Edit: You had && (and), but that would check if the player is in all three teams altogether, so it should be || (or), also changed -1 to 0xFFFFFFFF, just in case it does not work with -1.


Re: Dosent Set player to team color - iBots - 24.11.2013

change - 1 ,it will be like this:
public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == Team_Cop)
{
SetPlayerColor(playerid, COLOR_BLUE);
}
if(gTeam[playerid] == Team_Civi || gTeam[playerid] == Team_Rape || gTeam[playerid] == Team_Kidnapper)
{
SetPlayerColor(playerid, 0xFFFFFFFF);
}
return 1;
}


Re: Dosent Set player to team color - iBots - 24.11.2013

public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == Team_Cop)
{
SetPlayerColor(playerid, COLOR_BLUE);
}
if(gTeam[playerid] == Team_Civi || gTeam[playerid] == Team_Rape || gTeam[playerid] == Team_Kidnapper)
{
SetPlayerColor(playerid, 0xFFFFFFFF);
}
return 1;
}


Re: Dosent Set player to team color - Konstantinos - 24.11.2013

The problem was that a player cannot be 3 different teams at the same time, you had to use || instead of && (Like Dragonsaurus said).

I'd also like to point out that: 0xFFFFFFFF is -1
Hex are also numbers, so the problem was not that!