Raised This Month: $ Target: $400
 0% 

[Solved]How to count the connections to the server?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 07-15-2010 , 09:23   [Solved]How to count the connections to the server?
Reply With Quote #1

-title-
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2010 , 09:39   Re: How to count the connections to the server?
Reply With Quote #2

Use your brain or search. This is probably the most basic plugin one can make and im sure its been done multiple times.
__________________
Bugsy is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-15-2010 , 09:39   Re: How to count the connections to the server?
Reply With Quote #3

PHP Code:
new gConnections

public client_connect(id)
{
    
gConnections gConnections 1

__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Vechta
Veteran Member
Join Date: Jun 2010
Old 07-15-2010 , 10:04   Re: How to count the connections to the server?
Reply With Quote #4

Ehm g_Connections += 1 is not the same ?
Vechta is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-15-2010 , 10:06   Re: How to count the connections to the server?
Reply With Quote #5

gConnections++


dont forget to save the count in a file/nvault!
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-15-2010 , 10:08   Re: How to count the connections to the server?
Reply With Quote #6

Yes it is the same. You can also do g_Connections++ or ++g_Connections. They all will do the same thing in this instance.
__________________
Bugsy is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 07-15-2010 , 10:29   Re: How to count the connections to the server?
Reply With Quote #7

I thought there was some difference between something++ and ++something, just didn't know what exactly.
Backstabnoob is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 07-15-2010 , 10:43   Re: How to count the connections to the server?
Reply With Quote #8

Thanks ;D
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 07-15-2010 , 11:39   Re: How to count the connections to the server?
Reply With Quote #9

Quote:
Originally Posted by Backstabnoob View Post
I thought there was some difference between something++ and ++something, just didn't know what exactly.
I don't know exactly how to explain it with words, but I can with this:

PHP Code:
for(new i=015i++)
{
    
// i is 0 first
    // ...
    // i is 14 last
}

for(new 
i=015; ++i)
{
    
// i is 1 first
    // ...
    // i is 15 last

Both of them will loop the same number of times. The only difference is that the first one is increasing i after the function, and the second one is increasing it before.

If I am not mistaken...
RedRobster is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-15-2010 , 12:05   Re: How to count the connections to the server?
Reply With Quote #10

Quote:
Originally Posted by RedRobster View Post
I don't know exactly how to explain it with words, but I can with this:

PHP Code:
for(new i=015i++)
{
    
// i is 0 first
    // ...
    // i is 14 last
}
 
for(new 
i=015; ++i)
{
    
// i is 1 first
    // ...
    // i is 15 last

Both of them will loop the same number of times. The only difference is that the first one is increasing i after the function, and the second one is increasing it before.

If I am not mistaken...
You're thinking correctly, but ++i and i++ result in the same thing in a loop. So in both loops first and last i will be 0 and 14.
Code:
new i = 10;   if (++i == 10) // If 11 is equal to 10 {         // i is now 11 }
Code:
new i = 10;   if (i++ == 10) // If 10 is equal to 10 {         // i is now 11 }
__________________
hleV is offline
Reply



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 07:14.


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