SA-MP Forums Archive
SetPlayerToTeamColor - 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: SetPlayerToTeamColor (/showthread.php?tid=300333)



SetPlayerToTeamColor - Black Axe - 29.11.2011

Well , Yah i am Questionable - But really , i am just trying to learn - Forgive me

Anyway.. I Did this..

PHP код:
stock SetPlayerToTeamColor(playerid)
{
    if (
gTeam[playerid] == TEAM_Mafia1)
    {
    
SetPlayerColor(playeridTCOLOR_LIGHTGREEN);
    }
    else if (
gTeam[playerid] == TEAM_Mafia2)
    {
    
SetPlayerColor(playeridTCOLOR_NAVYBLUE);
    }
    else if (
gTeam[playerid] == TEAM_Mafia3)
    {
    
SetPlayerColor(playeridTCOLOR_BEIGE);
    }

At the Bottom of the Script..It Complies without Warnings / Errors But when i Choose any of the Teams my color doesn't Change...

Any Help would be Appreciated.


Re: SetPlayerToTeamColor - AstonDA-G - 29.11.2011

You forgot to define gTeam first.

Код:
stock SetPlayerToTeamColor(playerid)
{
    gTeam[playerid] = GetPlayerTeam(playerid);
    if (gTeam[playerid] == TEAM_Mafia1)
    {
    SetPlayerColor(playerid, TCOLOR_LIGHTGREEN);
    }
    else if (gTeam[playerid] == TEAM_Mafia2)
    {
    SetPlayerColor(playerid, TCOLOR_NAVYBLUE);
    }
    else if (gTeam[playerid] == TEAM_Mafia3)
    {
    SetPlayerColor(playerid, TCOLOR_BEIGE);
    }
}
Notice the GetPlayerTeam(playerid) part.


Re: SetPlayerToTeamColor - MP2 - 29.11.2011

Quote:
Originally Posted by Black Axe
Посмотреть сообщение
It Complies without Warnings / Errors But when i Choose any of the Teams my color doesn't Change....
Put

pawn Код:
printf("player %i team: %i", playerid, gTeam[playerid]);
on the first line and see what it prints in the server console/server_log.txt