Raised This Month: $32 Target: $400
 8% 

[Suggestion] get_players flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-25-2017 , 19:40   [Suggestion] get_players flags
Reply With Quote #1

Is possible to include a flag in get_players() native to also return number of players in both teams?

Something like else get_players(players, num "j") // return players in both teams excluding Specs ?

Ps. it will avoid to use double get_players to get count of both teams or a loop that check this??
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-26-2017 , 04:49   Re: [Suggestion] get_players flags
Reply With Quote #2

use get_players() twice
__________________
retired chump
DjSoftero is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-26-2017 , 07:05   Re: [Suggestion] get_players flags
Reply With Quote #3

Quote:
Originally Posted by DjSoftero View Post
use get_players() twice
Did you read post bro?

Ps. i'm look at amxmodx code and think that is easy to implement
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-26-2017 , 07:37   Re: [Suggestion] get_players flags
Reply With Quote #4

Quote:
Originally Posted by ^SmileY View Post
Did you read post bro?

Ps. i'm look at amxmodx code and think that is easy to implement
We can't have it include "both" teams, because not all mods have 2 "main" teams and get_players() is a part of the Core, not CStrike.
Maybe if we change the prototype into
PHP Code:
native get_players(players[MAX_PLAYERS], &num, const flags[] = ""any:...); 
it would allow for
PHP Code:
new players[MAX_PLAYERS];
new 
playersCount;
get_players(playersplayersCount"e""TERRORIST""CT"); 
would also open up the possibility for more advanced flags in the future.
__________________
klippy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-26-2017 , 08:40   Re: [Suggestion] get_players flags
Reply With Quote #5

Well, it could also return all players that are not hltv/spec which should be compatible with all the other games i think
__________________
Depresie is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-27-2017 , 08:02   Re: [Suggestion] get_players flags
Reply With Quote #6

Quote:
Originally Posted by KliPPy View Post
We can't have it include "both" teams, because not all mods have 2 "main" teams and get_players() is a part of the Core, not CStrike.
Maybe if we change the prototype into
PHP Code:
native get_players(players[MAX_PLAYERS], &num, const flags[] = ""any:...); 
it would allow for
PHP Code:
new players[MAX_PLAYERS];
new 
playersCount;
get_players(playersplayersCount"e""TERRORIST""CT"); 
would also open up the possibility for more advanced flags in the future.
Also can be in this way, since amxx core can check the game teams.

Ps. you not need to check both teams since in loop can skip "SPECTATORS" and "HLTV"
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-28-2017 , 14:49   Re: [Suggestion] get_players flags
Reply With Quote #7

It would be nice to add a flag in the get_players function that will find players with certaing admin flags only.

get_players(iPlayers, iPnum, "j", "abcdeimnu")
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-28-2017 , 19:48   Re: [Suggestion] get_players flags
Reply With Quote #8

Will change what, your suggestion compared to the default way to run two loops? Just optimization?
__________________








CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-28-2017 , 19:50   Re: [Suggestion] get_players flags
Reply With Quote #9

It's much more convinient to do this in one line instead of doing the same thing multiple times.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-01-2018 , 09:24   Re: [Suggestion] get_players flags
Reply With Quote #10

https://github.com/alliedmodders/amxmodx/pull/476 - I've managed to make the admin flags part. I may or may not try to do the multiple teams one.

PHP Code:
/* This will match players that have all of the "abcdei" admin flags */
get_players(iPlayersiPnum"j""abcdei")

/* This will match players that have any of the "abcdei" admin flags */
get_players(iPlayersiPnum"k""abcdei"
__________________

Last edited by OciXCrom; 01-01-2018 at 09:24.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 05:46.


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