AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Total points of all players (https://forums.alliedmods.net/showthread.php?t=332735)

tepegoz 05-29-2021 16:16

Total points of all players
 
I have this PlayerPoints[id][x] function but I want to collect the points of all the players in both t and ct teams. If there are 6 players in teams, it will be sum of total2/6 = total. How to collect on total can you make a example script?

PHP Code:

        new total,total2
        
for(x=1x<=UPGRADESx++) {
    
    if(
PlayerPoints[id][x] == 8)
    
total2 += 125
    
if(PlayerPoints[id][x] == 7)
    
total2 += 100
    
if(PlayerPoints[id][x] == 6)
    
total2 += 75
    
if(PlayerPoints[id][x] == 5)
    
total2 += 50
    
if(PlayerPoints[id][x] == 4)
    
total2 += 25
    
}    
        
total = +.....total2 ?



kww 05-29-2021 17:27

Re: Total points of all players
 
maybe something like this?....
PHP Code:

new players[32], playerCountpid
get_players
(playersplayerCount"ch"// get all players, exclude bots and hltv
//if you do not want to exclude bots remove "c" flag there

new totaltemp
for(new 0playerCounti++) { // loop thru all players
    
pid players[i// cache player id
    
temp // reset before looping
    
for(1<= UPGRADESx++) {
        if(
PlayerPoints[pid][x] == 1)
            
temp += 150
        
if(PlayerPoints[pid][x] == 2)
            
temp += 375
        
... // MORE 'if' STATEMENTS
    
}
    
total += temp


Spoiler


All times are GMT -4. The time now is 02:36.

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