Raised This Month: $51 Target: $400
 12% 

Do something depends of player count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-13-2010 , 17:56   Do something depends of player count
Reply With Quote #1

Well, i have a simple question. I can't test right now, for that reason i am posting here.

Code:
new g_iPlayers; public client_connect(id) {     g_iPlayers++;         DoSomething(); } public client_disconnect(id) {     g_iPlayers--;         DoSomething(); } public DoSomething() {     if(g_iPlayers > 5)     {         // some code here     }     else     {         // some code here     } }

I want to know if this method is correct or i have to add something to fix bugs, or something like that.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
tm.
Member
Join Date: Apr 2010
Old 08-13-2010 , 18:19   Re: Do something depends of player count
Reply With Quote #2

I think (not sure) that client_disconnect it's not called if player disconnects before putinserver.

Last edited by tm.; 08-13-2010 at 18:22.
tm. is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-13-2010 , 18:25   Re: Do something depends of player count
Reply With Quote #3

Ye for that reason i ask that, becouse i am not really sure and i think will have some bugs.

The only thing that i think i can use appart of that or with that, is SVC_DISCONNECT message.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-13-2010 , 18:41   Re: Do something depends of player count
Reply With Quote #4

get_players()
__________________
fysiks is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-13-2010 , 19:57   Re: Do something depends of player count
Reply With Quote #5

OHHHH, i am really stupid, i used that for an old plugin and now didn't think about it... thanks. Also i think that get_playersnum() is best in this case.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-13-2010 , 22:47   Re: Do something depends of player count
Reply With Quote #6

Quote:
Originally Posted by Alucard^ View Post
OHHHH, i am really stupid, i used that for an old plugin and now didn't think about it... thanks. Also i think that get_playersnum() is best in this case.
Oh yeah . I don't use that one much. Forgot about it.
__________________
fysiks is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-14-2010 , 19:10   Re: Do something depends of player count
Reply With Quote #7

Sry didn't understand at all what you said (cuz my english is not really good).. you said to me, to forgot about get_playersnum() or get_players()?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2010 , 19:13   Re: Do something depends of player count
Reply With Quote #8

Both are fine, if you don't need the list of players, use get_playersnum(), it also provide an extra argument so you can count connecting players.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2010 , 23:29   Re: Do something depends of player count
Reply With Quote #9

Quote:
Originally Posted by Alucard^ View Post
Sry didn't understand at all what you said (cuz my english is not really good).. you said to me, to forgot about get_playersnum() or get_players()?
I said I forgot about get_playersnum() because I don't use it much if at all.
__________________
fysiks is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-15-2010 , 12:09   Re: Do something depends of player count
Reply With Quote #10

Ah ok, Thanks =p
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 02:35.


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