Confusing SetPlayerTeam
#1

Код:
stock xSetPlayerTeam(id, team)
{
    #if TESTING
		printf("ID:%i, Name:%s, Old Team: %i, New Team: %i", id, idName[id], GetPlayerTeam(id), team);
	#endif

	if( team != GetPlayerTeam(id) )
	{
		switch(team)
		{
			case TEAM_USA:UPlayers++;
			case TEAM_EUR:EPlayers++;
	 		case TEAM_ARAB:ABPlayers++;
	   		case TEAM_AUS:ASPlayers++;
		    case TEAM_SOV:SPlayers++;
		    case TEAM_LAT:LPlayers++;
		    case TEAM_TERR:TPlayers++;
		    case TEAM_ASIA:APlayers++;
		}
		if(team == (id+10)) FPlayers++;

		switch(GetPlayerTeam(id))
		{
			case TEAM_USA:UPlayers--;
			case TEAM_EUR:EPlayers--;
	 		case TEAM_ARAB:ABPlayers--;
	   		case TEAM_AUS:ASPlayers--;
		    case TEAM_SOV:SPlayers--;
		    case TEAM_LAT:LPlayers--;
		    case TEAM_TERR:TPlayers--;
		    case TEAM_ASIA:APlayers--;
		}
		if(GetPlayerTeam(id) == (id+10)) FPlayers--;
		
        
	}
	return SetPlayerTeam(id, team);
}
This prints new team same as old team.

I replaced all SetPlayerTeam in my script...

Any idea why?
Reply
#2

SetPlayerTeam and GetPlayerTeam is pretty much bugged as far as i know and hasn't been fixed.

Stick to variables.
Reply
#3

I tried replacing GetPlayerTeam with a PVar i set each time, team changes. But i got the same effect.
Reply
#4

Quote:
Originally Posted by cmg4life
Посмотреть сообщение
I tried replacing GetPlayerTeam with a PVar i set each time, team changes. But i got the same effect.
To be honest, I don't really understand what you are actually trying to do.
Reply
#5

Keeping a player count via a function... -_-'
Reply
#6

Quote:
Originally Posted by cmg4life
Посмотреть сообщение
Keeping a player count via a function... -_-'
Ahh, i understand now. It was confusing, you should have explained from the start!

Then how about doing some checks with printf?
Maybe the code stops somewhere. I know it may sound strange but this way i solved many of my problems that were just..unexplainable.

pawn Код:
stock xSetPlayerTeam(id, team)
{
    #if TESTING
        printf("ID:%i, Name:%s, Old Team: %i, New Team: %i", id, idName[id], GetPlayerTeam(id), team);
    #endif

    if( team != GetPlayerTeam(id) )
    {
        print("after team != ... ");
       
        switch(team)
        {
            case TEAM_USA:UPlayers++;
            case TEAM_EUR:EPlayers++;
            case TEAM_ARAB:ABPlayers++;
            case TEAM_AUS:ASPlayers++;
            case TEAM_SOV:SPlayers++;
            case TEAM_LAT:LPlayers++;
            case TEAM_TERR:TPlayers++;
            case TEAM_ASIA:APlayers++;
        }
        if(team == (id+10)) FPlayers++;print("if(team ++");
       
        switch(GetPlayerTeam(id))
        {
            case TEAM_USA:UPlayers--;
            case TEAM_EUR:EPlayers--;
            case TEAM_ARAB:ABPlayers--;
            case TEAM_AUS:ASPlayers--;
            case TEAM_SOV:SPlayers--;
            case TEAM_LAT:LPlayers--;
            case TEAM_TERR:TPlayers--;
            case TEAM_ASIA:APlayers--;
        }
        if(GetPlayerTeam(id) == (id+10)) FPlayers--;print("if(GetPlayerTeam --");
       
        switch(team)
        {
            case TEAM_USA..TEAM_ASIA:printf("Team Changed for team %d",team);
        }
       
        print("after switches");


    }
    return SetPlayerTeam(id, team);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)