SA-MP Forums Archive
Why wont SetPlayerColor work?? - 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: Why wont SetPlayerColor work?? (/showthread.php?tid=279696)



Why wont SetPlayerColor work?? - Tigerbeast11 - 28.08.2011

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?


Re: Why wont SetPlayerColor work?? - Wesley221 - 28.08.2011

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


Re: Why wont SetPlayerColor work?? - BlackWolf120 - 28.08.2011

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


Re: Why wont SetPlayerColor work?? - Tigerbeast11 - 28.08.2011

Nice! Thanks, Ill try it and report back!


Re: Why wont SetPlayerColor work?? - Tigerbeast11 - 28.08.2011

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;
}



Re: Why wont SetPlayerColor work?? - Jafet_Macario - 28.08.2011

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



Re: Why wont SetPlayerColor work?? - Tigerbeast11 - 28.08.2011

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


Re: Why wont SetPlayerColor work?? - =WoR=Varth - 29.08.2011

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



Re: Why wont SetPlayerColor work?? - [MWR]Blood - 29.08.2011

Maybe because you are "president"...