AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help]Orpheu: AutoTeamBalances (https://forums.alliedmods.net/showthread.php?t=243558)

yokomo 07-06-2014 09:51

[Help]Orpheu: AutoTeamBalances
 
Hi, i am making an "Instant Team Balances" plugin for CS1.6 Deathmatch gameplay (no roundend). But something goes wrong, the function is called but it not balance the teams but inverted.

For example:
Current TR -- 8 players
Current CT -- 4 players

If one player disconnect then i set AutoTeamBalance after 10 seconds. When the function called, current players will be:
Current TR -- 9 players
Current CT -- 2 players

Orpheu code


Is my math calculation fault or engine fault?

GuskiS 07-06-2014 11:38

Re: [Help]Orpheu: AutoTeamBalances
 
I can't help you with that orpheu thing but the code looks fine. You could do a debug after calling orpheu function, example, also little improved code:

PHP Code:

public TaskBalanceTeam()
{
    new 
iTR GetPlayerCount(1//T count
    
new iCT GetPlayerCount(2//CT count
    
    //players >= 2 in 1 team, then call BalanceTeams
    
if(abs(iTR-iCT) >= 2)
    {
        
client_print(0print_chat"[ITB] TR: [%d] -- CT: [%d]"iTRiCT//debug chat
        
OrpheuCall(BalanceTeamsGameRules)
        
client_print(0print_center"*** Teams Auto Balanced, Check Your Team ***")
        
client_print(0print_chat"[ITB] NEW TR: [%d] -- CT: [%d]"GetPlayerCount(1), GetPlayerCount(2)) //debug chat
    
}
}

// No need for fakemeta
GetPlayerCount(team)
{
    new 
num;
    static 
players[32];
    
get_players(playersnum"e"team == "TERRORIST" "CT");
    return 
num;


Then you will see where to search for you problem. It might be something with those orpheu files in configs folder? :?

yokomo 07-06-2014 12:46

Re: [Help]Orpheu: AutoTeamBalances
 
If error on Orpheu it will show log and plugin will not running for sure. Signature is correct, as i said function was called. Maybe auto team balance will only called x time in 1 round.

I use this stock for more accurate return.
Code:

//get team player count 1=TR | 2=CT
GetPlayerCount(team)
{
    new
j, iCount = 0
   
for(j=1;j<=iMaxClients;j++)
    {
        if(!
is_user_connected(j)) continue;
       
        if(
fm_cs_get_user_team(j) == team) iCount++
    }
    return
iCount;
}



All times are GMT -4. The time now is 21:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.