PHP Code:
add( g_szMenu, 63, "\yVote for time limit^n^n" );
add( g_szMenu, 63, "\r1. \wVote^n" );
add( g_szMenu, 63, "\r2. \wDon't Vote" );
It's faster to store the current position and use
formatex() since
add() has to execute the VM equivalent of
strlen() each time it is run, but this is a very trivial optimization and probably not worth the time.
You could avoid this entirely by using new menus, which are much more suited for this task than old menus.
PHP Code:
new iPlayers[ MAXPLAYERS ], iNum;
get_players( iPlayers, iNum, "ch" );
It's faster to just iterate over all indices starting from 1 and going to 32, but with flags it may be more costly this way. I would leave it as is, but if you feel like benchmarking something, that would be interesting.
PHP Code:
iClient = iPlayers[ i ];
show_menu( iClient, g_iKeys, g_szMenu, 25, "VoteMenu" );
This is a trivial assignment and saves no typing/cost as you only use the variable once.
PHP Code:
new iAverage = g_iVoteSum / g_iVotesCount;
This will truncate decimals, even if they are above .5.
PHP Code:
if( !is_str_num( szArg ) )
{
client_print( iClient, print_chat, "** Invalid input, please try again." );
client_cmd( iClient, "messagemode your_suggested_timelimit" );
return PLUGIN_HANDLED;
}
Consider allowing some sort of exit.
PHP Code:
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1044\\ f0\\ fs16 \n\\ par }
*/
May want to get rid of that. Pretty trivial though and some of my plugins have that at the end, too.
__________________