I'm currently using this code which i kinda stole from another plugin. The problem is that it doesn't show the vips correctly. For players without the VIP flag, it will always show "No vips online", while people who have the VIP flag will always get a message that outputs all the player names in the server. Any idea how i can fix this?
PHP Code:
public VipsOnline(id) {
new bool:IsFirst = true, szMessage[256], iLen, TempID;
for(TempID = 0; TempID <= get_maxplayers(); TempID++)
{
if( !is_user_connected(TempID) || !(get_user_flags(id) & VIP_LEVEL) )
{
continue;
}
if( !IsFirst )
{
szMessage[iLen++] = ' ';
szMessage[iLen++] = '|';
szMessage[iLen++] = ' ';
}
szMessage[iLen++] = '^x04';
szMessage[iLen] = EOS;
iLen += get_user_name(TempID, szMessage[iLen], charsmax(szMessage) - iLen);
szMessage[iLen++] = '^x01';
szMessage[iLen] = EOS;
IsFirst = false;
}
if( IsFirst )
{
ColorChat(id, GREEN, "There are no vips online.");
return PLUGIN_HANDLED;
}
else
{
ColorChat(id, TEAM_COLOR, "Online Vips: %s", szMessage);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE
}
EDIT: I might've found the reason for this isue, i was using "id" instead of "TempID" on this line
PHP Code:
if( !is_user_connected(TempID) || !(get_user_flags(id) & VIP_LEVEL) )
__________________