Why wont SetPlayerColor work??
#1

Here is my code:
pawn Код:
if(President[playerid] == 1)//Under OnPlayerSpawn
    {
        SetPlayerColor(playerid,yellow);
    }
    else
    {
        if(IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid))
        {
            SetPlayerColor(playerid,white);
        }
    }
Iam an Admin, but Im also president. I want it to set my color to yellow if Im president. But it always makes it white. Why?
Reply
#2

pawn Код:
if(President[playerid] == 1)//Under OnPlayerSpawn
    {
        SetPlayerColor(playerid,yellow);
        return 1;
    }
    else
    {
        if(IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid))
        {
            SetPlayerColor(playerid,white);
        }
    }
This should work i think
Reply
#3

or simply add another statement:

pawn Код:
if(President[playerid] == 1)
    {
        SetPlayerColor(playerid,yellow);
    }
if(IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid))
    {
        SetPlayerColor(playerid,white);
    }
if(President[playerid] == 1 && IsPlayerXAdmin(playerid))//if u are admin and president
    {
        SetPlayerColor(playerid,yellow);
    }
i like it to keep things simple
Reply
#4

Nice! Thanks, Ill try it and report back!
Reply
#5

I tried your code, still not working... This is my whole "OnPlayerSpawn":
pawn Код:
public OnPlayerSpawn(playerid)
{
    //TextDrawShowForPlayer(playerid,Timer);
    TextDrawShowForPlayer(playerid,RScores);
    TextDrawShowForPlayer(playerid,BScores);
   
    if(IsPlayerVIP(playerid) || President[playerid] == 1)
    {
        SetPlayerArmour(playerid,100);
    }
    if(Team[playerid] == TEAM_RED)
    {
        if(!IsPlayerXAdmin(playerid) || !IsPlayerVIP(playerid))
        {
            SetPlayerColor(playerid,RED);
        }
    }
    else
    {
        if(!IsPlayerXAdmin(playerid) || !IsPlayerVIP(playerid))
        {
            SetPlayerColor(playerid,BLUE);
        }
    }
    if(President[playerid] == 1)
    {
        SetPlayerColor(playerid,yellow);
    }
    else if((IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid) && (President[playerid] == 0)))
    {
        SetPlayerColor(playerid,white);
   
    }
    else if((President[playerid] == 1) && (IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid)))
    {
        SetPlayerColor(playerid,yellow);
    }
    return 1;
}
Reply
#6

Try this:
pawn Код:
forward SetColor(playerid);
public SetColor(playerid)
{
    if(President[playerid] == 1)
    {
        SetPlayerColor(playerid,yellow);
    }
    if(IsPlayerXAdmin(playerid) && IsPlayerVIP(playerid))
    {
        SetPlayerColor(playerid,white);
    }
    if(Team[playerid] == TEAM_RED)
    {
        SetPlayerColor(playerid,RED);
    }
    if((President[playerid] == 1) && (IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid)))
    {
        SetPlayerColor(playerid,yellow);
    }
    else
    {
        SetPlayerColor(playerid,BLUE);
    }
}
SetColor(playerid); // OnPlayerSpawn
Reply
#7

Nice try, but no, it still doesn't work.
Reply
#8

pawn Код:
if(President[playerid] != 1)//Under OnPlayerSpawn
{
    if(IsPlayerXAdmin(playerid) || IsPlayerVIP(playerid)) SetPlayerColor(playerid,white);
}
else SetPlayerColor(playerid,yellow);
Reply
#9

Maybe because you are "president"...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)