Quote:
Originally Posted by Natsheh
The 2nd code in your post will output the last vip in the players array, test it with two vips and you will see what is happening.
|
Sorry, after testing it i found i was wrong but i tried to optimize for the code by using strlen native
Is there any problem with this ? or another way is faster than this ?
PHP Code:
@OnVipsOnline( id )
{
new szBuffer[ MAX_TEXT_LENGTH ], szPlayers[ MAX_PLAYERS ], iNum;
get_players( szPlayers, iNum)//, "ch" );
for( new iIndex, i; i < iNum; i++ )
{
if( g_iPlayer[ ( iIndex = szPlayers[ i ] ) ][ VIP ] & g_iSettings[ Access_OnlineList ] )
{
formatex( szBuffer[ strlen( szBuffer ) ], charsmax( szBuffer ), "%s, ", g_iPlayer[ iIndex ][ Name ] )
}
}
if( szBuffer[ 0 ] != EOS )
{
szBuffer[ strlen( szBuffer ) - 2 ] = '.'
CC_SendMessage( id, szBuffer );
}
else
{
CC_SendMessage( id, "There are no vip's online." );
}
}
__________________