you spelled average wrong
are you porting PTB to amxx or revising it or you the original author...?
if a function isn't working correctly and it should, then check the server console for runtime errors, because if you get those it drops out of the function without executing any more code.