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

Question about native : get_players


Post New Thread Reply   
 
Thread Tools Display Modes
101
Member
Join Date: Nov 2023
Old 12-09-2023 , 08:19   Re: Question about native : get_players
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
I've been told is much more efficient to use get_players() in most all cases
i think they were wrong , if u see my script that deals with CT,CT_A,T,T,A , then i had to call the native get_players 4 times in millisecond (a lot of work) . if u had a look of what Mr Bugsy wrote .
creating a loop by ur own is much better if u have to deal with data that should be refreshed every half-second .

Quote:
Originally Posted by fysiks View Post
P.S. Whitespace is not your enemy
no it is , remove them make the code looks under control with contiguous homogeneous groups .

Thank u all for responding
I appreciate your replies

Last edited by 101; 12-09-2023 at 08:21.
101 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-09-2023 , 19:15   Re: Question about native : get_players
Reply With Quote #12

Quote:
Originally Posted by WATCH_D0GS UNITED View Post
It could be really better to see the source of all natives to see how many stuff they're using to get the results.

After decompiling, you can get something like this:
Why would you try to decompile anything in AMX Mod X? It's all open source and freely available on GitHub.

Quote:
Originally Posted by 101 View Post
i think they were wrong , if u see my script that deals with CT,CT_A,T,T,A , then i had to call the native get_players 4 times in millisecond (a lot of work) . if u had a look of what Mr Bugsy wrote .
creating a loop by ur own is much better if u have to deal with data that should be refreshed every half-second .
I didn't say that get_players() was the prefect solution for this specific use case (I can't prove that without actually benchmarking both methods). You do know, though, that computers are very fast right? Calling something every 500 ms isn't really all that bad. A lot of people seem to want to unnecessarily optimize code that is not causing any actual problems. IMO, don't try to optimize something this hard unless it's actually causing a problem.

Regardless, it would be interesting if you could benchmark both methods to actually see if there is a significant difference instead of just assuming base on your feelings.

Quote:
Originally Posted by 101 View Post
no it is , remove them make the code looks under control with contiguous homogeneous groups .
LOL, I guess you're a comedian.
__________________

Last edited by fysiks; 12-09-2023 at 19:16.
fysiks is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 12-09-2023 , 20:30   Re: Question about native : get_players
Reply With Quote #13

Well... https://github.com/alliedmodders/amx...ns/compile.exe

Where to find things like https://www.amxmodx.org/api/cvars/get_pcvar_num (All the procedure)
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
101
Member
Join Date: Nov 2023
Old 12-09-2023 , 20:39   Re: Question about native : get_players
Reply With Quote #14

Quote:
Originally Posted by fysiks View Post
...................
just shut the f up , and focus on learning so u could give people useful answers instead .
101 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 12-09-2023 , 20:43   Re: Question about native : get_players
Reply With Quote #15

get out of doubt with profiler
__________________
mlibre is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-10-2023 , 06:25   Re: Question about native : get_players
Reply With Quote #16

Quote:
Originally Posted by WATCH_D0GS UNITED View Post
I find it funny that you linked to the compiler on github but didn't consider searching in the same place for the source code of get_pcvar_num. The full source code is available in the link you posted (https://github.com/alliedmodders/amxmodx), just search/browse the code by the name of the native.
__________________

Last edited by HamletEagle; 12-10-2023 at 06:26.
HamletEagle is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 12-10-2023 , 08:55   Re: Question about native : get_players
Reply With Quote #17

0oh man, it's cvars.cpp not amxmodx.cpp. Thanks.
https://github.com/alliedmodders/amx...modx/cvars.cpp

Quote:
Originally Posted by mlibre View Post
get out of doubt with profiler
https://forums.alliedmods.net/showthread.php?t=67752

1.8.2?
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-10-2023 , 15:53   Re: Question about native : get_players
Reply With Quote #18

You really derailed such a basic topic..
@OP, hamelteagle first post says everything.
Basically if you use get_players you will end up making 2 loops. Yet it is better if you are reading many flags.

So if you want a simple check like knowing which users are alive you can simply do a normal loop and check inside for is_user_alive. But let’s say that you want alive players, from terrorist team and exclude bots. This way a get_players would fit better. But in the end of the day that becomes quite pointless. Like fysiks said, with the computers we have today this isn’t a problem.
__________________
Jhob94 is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 12-10-2023 , 21:42   Re: Question about native : get_players
Reply With Quote #19

Quote:
Originally Posted by Jhob94 View Post
You really derailed such a basic topic..
@OP, hamelteagle first post says everything.
Basically if you use get_players you will end up making 2 loops. Yet it is better if you are reading many flags.

So if you want a simple check like knowing which users are alive you can simply do a normal loop and check inside for is_user_alive. But letĀ’s say that you want alive players, from terrorist team and exclude bots. This way a get_players would fit better. But in the end of the day that becomes quite pointless. Like fysiks said, with the computers we have today this isnĀ’t a problem.
What it makes you believe ()e will accept your argument more than the HamletEagle's ones?
101 could come back to say everyone in this thread is a f*cking bastard

Also, it's really weird to see you are caring about native calls in these threads while in your NightCrawler Remake plugin you are using the FM_AddToFullPack forward, which is called more than 30.000 times/sec. in a 30 players scenario with 3 natives checks, which their values should be cached in another event which is called less times.
__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com

Last edited by WATCH_D0GS UNITED; 12-10-2023 at 21:48.
WATCH_D0GS UNITED is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-11-2023 , 01:52   Re: Question about native : get_players
Reply With Quote #20

The natives i use are get_orig_retval, is_user_alive and is_user_connected. There is no harm on doing that. Plus i have no idea what my plugins have to do with this topic.
__________________
Jhob94 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 02:10.


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