Raised This Month: $60 Target: $400
 15% 

how get count of players


Post New Thread Reply   
 
Thread Tools Display Modes
Balage74
Member
Join Date: Dec 2006
Old 10-16-2020 , 09:41   Re: how get count of players
Reply With Quote #21

I know this post is old, but maybe helping this for another coder:

Code:
new bool:g_firstjoin[33]

new g_sv_allplayers = 0
new g_sv_maxplayers = 0
new g_sv_imaxplayers = 0



public plugin_init() 
{ 
    register_event("TeamInfo", "event_jointeam", "a")     
}


public client_connect(id)
{
    g_firstjoin[id] = true

}


public event_jointeam()
{
    new id = read_data(1)
    if(is_valid_user(id))
    {
        if (g_firstjoin[id] == true) 
        {
            client_firstjoin(id)
        }
    }
}



public client_firstjoin(id)
{

        g_sv_allplayers++
        g_sv_imaxplayers++
        if (g_sv_imaxplayers > g_sv_maxplayers)  g_sv_maxplayers ++;

        g_firstjoin[id] = false
}

public client_disconnected(id)
{
    g_sv_imaxplayers--
}
g_sv_allplayer means all connected players
g_sv_allplayer means highest value of playernum on the map.
of course you can handle it per team as well.
__________________
Balage74 is offline
Send a message via MSN to Balage74 Send a message via Skype™ to Balage74
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-16-2020 , 16:09   Re: how get count of players
Reply With Quote #22

Quote:
Originally Posted by Balage74 View Post
I know this post is old, but maybe helping this for another coder:

Code:
new bool:g_firstjoin[33]

new g_sv_allplayers = 0
new g_sv_maxplayers = 0
new g_sv_imaxplayers = 0



public plugin_init() 
{ 
    register_event("TeamInfo", "event_jointeam", "a")     
}


public client_connect(id)
{
    g_firstjoin[id] = true

}


public event_jointeam()
{
    new id = read_data(1)
    if(is_valid_user(id))
    {
        if (g_firstjoin[id] == true) 
        {
            client_firstjoin(id)
        }
    }
}



public client_firstjoin(id)
{

        g_sv_allplayers++
        g_sv_imaxplayers++
        if (g_sv_imaxplayers > g_sv_maxplayers)  g_sv_maxplayers ++;

        g_firstjoin[id] = false
}

public client_disconnected(id)
{
    g_sv_imaxplayers--
}
g_sv_allplayer means all connected players
g_sv_allplayer means highest value of playernum on the map.
of course you can handle it per team as well.
What are you trying to do anyway? There is certainly some much easier way.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply


Thread Tools
Display Modes

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 23:10.


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