Raised This Month: $ Target: $400
 0% 

problem with the amount of players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 06-11-2014 , 13:25   problem with the amount of players
Reply With Quote #1

hi,

I used many ways to count the players on the server
Each of them wailed me

I way:
PHP Code:
GetPlayersNum(teamalive) {
    new 
iPlayers;
    for(new 
maxpl0i--) {
        if(!
is_user_connected(i)) continue;

        if(
get_user_team(i) == team && (is_user_alive(i) == alive || alive == 2)) iPlayers++;
    }
    return 
iPlayers;

II way:
PHP Code:
stock GetPlayersNum(teamalive) {
    if(!(
<= team <= 2)) return 0;

    static 
Players[33], num;
    for(new 
1<= maxpli++) {
        if(
get_user_team(i) != team || is_user_alive(i) != alive) continue;

        
Players[++num] = i;
    }
    return 
Players[num];

III way:
PHP Code:
stock GetPlayersNum(teamalive) {
    static 
players[32], numcount;
    
get_players(playersnumalive "ach" "ch");
    for(new 
inumi++)
        if(
get_user_team(players[i]) == teamcount++;

    return 
count;

IV way:
PHP Code:
stock GetPlayersNum(teamalive) {
    for(new 
num1<= maxpli++) {
        if(!
is_user_connected(i) || get_user_team(i) != team) continue;
        if(
alive && !is_user_alive(i)) continue;

        
num++;
    }
    return 
num;

V way:
PHP Code:
stock GetPlayersNum(teamalive) {
    static 
players[32], num;
    
get_players(playersnumalive "ach" "ch"team == "CT" "TERRORIST");
    return 
count;

maxpl = get_maxplayers()

stock is used every second (in task)
every stock working at 90%
10% - sometimes bad counts, for example, when 2 terrorists it shows 7

Last edited by OnePL; 06-11-2014 at 13:26.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:38.


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