View Single Post
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-07-2021 , 14:05   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #93

Quote:
Originally Posted by HamletEagle View Post
You don't need to have g_AveragePing global, since it is used only inside CheckPing. You could simply do:
PHP Code:
new AveragePing = (ePlayerData[id][g_Ping] / ePlayerData[id][g_Samples]) 
In general, it is best to avoid global variables, where possible. In pawn plugins, it is kinda hard since you have to maintain state and you can't do so by passing parameters around. But in this particular case, you can get rid of that global.
Also, compute the average once you have enough samples(in the if check if(ePlayerData[id][g_Samples] >= pCvars[VarTest])).

Other than that, everything looks fine.
Creating the variable as you said it allocates only 1 id and will be overwritten for each player the task runs, correct me if I'm wrong, but the variable doesn't need to be global [32 + 1]?

Edit: Forget it, I get what you mean, done.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 09-07-2021 at 14:10.
iceeedr is offline
Send a message via Skype™ to iceeedr