AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved get_players_ex vs get_players (https://forums.alliedmods.net/showthread.php?t=332938)

Supremache 06-09-2021 17:18

get_players_ex vs get_players
 
What is better ? get_players_ex or get_players and why !!

Bugsy 06-09-2021 17:33

Re: get_players_ex vs get_players
 
Read the function descriptions

https://www.amxmodx.org/api/amxmisc/get_players_ex
https://www.amxmodx.org/api/amxmodx/get_players

Supremache 06-09-2021 17:43

Re: get_players_ex vs get_players
 
Quote:

Originally Posted by Bugsy (Post 2749374)

What is the better!!

they are doing the same thing but the difference is with get_players_ex use named constants for flags instead of letters.

Bugsy 06-09-2021 19:04

Re: get_players_ex vs get_players
 
It does the same thing, so in that respect neither is better. _ex is easier to use as you do not need to dig up what each letter flag corresponds to each time you want to use it. It literally is the same besides the flags part.

PHP Code:

stock get_players_ex(players[MAX_PLAYERS] = {}, &numGetPlayersFlags:flags GetPlayers_None, const team[] = "")
{
    new 
strFlags[10];
    
get_flags(_:flagsstrFlagscharsmax(strFlags));
    
get_players(playersnumstrFlagsteam);



Supremache 06-10-2021 11:15

Re: get_players_ex vs get_players
 
Quote:

Originally Posted by Bugsy (Post 2749385)
It does the same thing, so in that respect neither is better. _ex is easier to use as you do not need to dig up what each letter flag corresponds to each time you want to use it. It literally is the same besides the flags part.

PHP Code:

stock get_players_ex(players[MAX_PLAYERS] = {}, &numGetPlayersFlags:flags GetPlayers_None, const team[] = "")
{
    new 
strFlags[10];
    
get_flags(_:flagsstrFlagscharsmax(strFlags));
    
get_players(playersnumstrFlagsteam);



I was think ex is much faster like formatex/format

fysiks 06-10-2021 21:39

Re: get_players_ex vs get_players
 
Quote:

Originally Posted by Supremache (Post 2749437)
I was think ex is much faster like formatex/format

No. That is not a valid comparison. If you actually look at the code Bugsy posted, you'll see that the _ex function calls the original function so it can't be faster than the original function.

Supremache 06-11-2021 23:15

Re: get_players_ex vs get_players
 
Quote:

Originally Posted by fysiks (Post 2749470)
No. That is not a valid comparison. If you actually look at the code Bugsy posted, you'll see that the _ex function calls the original function so it can't be faster than the original function.

Well, I got it


All times are GMT -4. The time now is 17:56.

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