Quote:
Originally Posted by HamletEagle
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.
__________________