Teams dont work (solved)
#1

The teams arent working, I do not get the clientmessage when spawning and I still have the DEADCONNECT color.
If there's any better way of doing this then please show me, I'm not a expert at this kind of stuff.
Код:
new gTeam[MAX_PLAYERS];
//Teams
#define Team_Police 0
#define Team_Medic 1
#define Team_Civilian 2

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerColor(playerid, COLOR_DEADCONNECT);
	SetPlayerPos(playerid, 359.3477, -2077.1821, 8.9575);
	SetPlayerInterior(playerid, 0);
	SetPlayerFacingAngle(playerid, 178.0051);
	SetPlayerCameraPos(playerid, 358.9874,-2084.0168,7.8359);
	SetPlayerCameraLookAt(playerid, 359.3477, -2077.1821, 8.9575);
	SetPlayerTeamFromClass(playerid, classid);

	switch(classid)
	{
	    case 0..281:
	    {
	        GameTextForPlayer(playerid, "~w~CIVILIAN", 3000, 3);
		}
		case 282..287:
		{
		    GameTextForPlayer(playerid, "~b~~h~MEDIC", 3000, 3);
		}
		case 288..299:
		{
		    GameTextForPlayer(playerid, "~b~POLICE", 3000, 3);
		}
	}
	return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid >= 288 && classid <= 299)
	{
	    gTeam[playerid] = Team_Police;
	}
	else if(classid >= 282 && classid <= 287)
	{
	    gTeam[playerid] = Team_Medic;
	}
	else if(classid >= 0 && classid <= 281)
	{
	    gTeam[playerid] = Team_Civilian;
	}
}
forward public SetPlayerToTeamColor(playerid);
public SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == Team_Police)
	{
	    SetPlayerColor(playerid, COLOR_BLUE);
	}
	if(gTeam[playerid] == Team_Medic)
	{
	    SetPlayerColor(playerid, COLOR_PINK);
	}
	if(gTeam[playerid] == Team_Civilian)
	{
	    SetPlayerColor(playerid, COLOR_WHITE);
	}
	return 1;
}
Reply
#2

Show your OnPlayerSpawn.
Reply
#3

You aren't setting the team on Request Class?

an example

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
         case 0:
         {
               SetPlayerTeam(playerid, TEAM); // replace TEAM
         }
         case 1:
         {
               SetPlayerTeam(playerid, TEAM); // replace TEAM again...
         }
    }
    return 1;
}
I think you get the point. Your just setting the GameTextForPlayer and not giving the player a chance to set their team.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)