team balancer didnt working.
#1

Код:
public OnPlayerRequestSpawn(playerid) 
{ 
    for(new p = 0; p < GetMaxPlayers(); p++)
    {
        if (gTeam[p] == Yakuza) Count1++; 
        else if (gTeam[p] == Nostra) Count2++;
        else if (gTeam[p] == Policija) Count3++; 
		else if (gTeam[p] == Triads) Count4++; 
    }
    if ((Count1 > Count2) && gTeam[playerid] == Yakuza) 
    { 
        ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Atsipraрome, taиiau\nРi komanda yra pilna, pasirinkite kitа.", "Gerai", "Uюdaryti");
        return 0;.
    }
    else if ((Count2 > Count1) && gTeam[playerid] == Nostra && GetPlayerScore( playerid ) < 1500 )
    { 
        ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Atsipraрome, taиiau\nJыs neturite 1.500 patirties taрkш,\nArba рi komanda yra pilna, pasirinkite kitа.", "Gerai", "Uюdaryti");
        return 0;
    }
    else if ((Count3 > Count2) && gTeam[playerid] == Policija && GetPlayerScore( playerid ) < 3000 )
    { 
        ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Atsipraрome, taиiau\nJыs neturite 3.000 patirties taрkш,\nArba рi komanda yra pilna, pasirinkite kitа.", "Gerai", "Uюdaryti"); 
        return 0;
    }
    if ((Count4 < Count3) && gTeam[playerid] == Yakuza) 
    { 
        ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Atsipraрome,\nРi komanda yra pilna, pasirinkite kitа.", "Gerai", "Uюdaryti");
        return 0;
    }
	return 1;
}
Sometimes it works, and sometimes no.. When i turn server on( OnGameModeInit ) and try to join Triads team, it say, that team is full ( on OGMI count1 2 3 4 = 0; ) when i try to join police team, its good, but my score <3000..
Reply
#2

Although the checks for the balance dont make sense in my opinion

I think the main problem is that the count variable are global and never reseted
Means each time OnPlayerRequestSpawn is called the variables change and everything gets messed up
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)