AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   array average on players (https://forums.alliedmods.net/showthread.php?t=156948)

monolit 05-14-2011 07:48

array average on players
 
I would like to add skill to every player in winer team,

The amount of skill added should be the average of opposite team skill.

Is it something like this? :

PHP Code:

    new CTPlayers[32], totalSkill;
    new 
CTplayerCountiCTplayer
    get_players
(CTPlayersCTplayerCount"h")
    for (
i=0i<CTplayerCounti++)
    {
        if(
cs_get_user_team(i) != CS_TEAM_CT)
            continue;
            
        
CTplayer CTPlayers[i];
            
        
totalSkill+= iSkill[CTplayer];
    }
    
    new 
TPlayers[32]
    new 
TplayerCountxTplayer
    get_players
(TPlayersTplayerCount"h")
    new 
Float:avgskill totalSkill TplayerCount 0.0
    for (
x=0x<TplayerCountx++)
    {
        if(
cs_get_user_team(i) != CS_TEAM_T)
            continue;
            
        
Tplayer TPlayers[x]
        
iSkill[Tplayer]+= avgskill 0.0;
    } 

Sorry I can't test it out because I haven't any server.


All times are GMT -4. The time now is 04:23.

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