Hello, I have a little problem with my hud plugin, idk what I'm doing wrong.
It's supposed to show HUD to players that are not VIP / admins / root, but it doesn't.
I did some simple "debugging" and seems like it detects my flags correctly. When I remove that part about VIP, it shows hud without any problem (non vip+vip) but when I add it, no one(non VIP + vip)
don't see the HUD.(only non vips are supposed to see it)
PHP Code:
public void OnPluginStart()
{
CreateTimer(5.0, HUD, _, TIMER_REPEAT);
}
char GetServerIP() {
char NetIP[32];
int pieces[4];
int longip = FindConVar("hostip").IntValue;
pieces[0] = (longip >> 24) & 0x000000FF;
pieces[1] = (longip >> 16) & 0x000000FF;
pieces[2] = (longip >> 8) & 0x000000FF;
pieces[3] = longip & 0x000000FF;
Format(NetIP, sizeof(NetIP), "%d.%d.%d.%d:%d", pieces[0], pieces[1], pieces[2], pieces[3], FindConVar("hostport").IntValue);
return NetIP;
}
public Action HUD(Handle timer, int client)
{
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
if(IsVIP(i))
{
return Plugin_Continue;
}
else
{
SetHudTextParams(-0.8, 0, 5.0, 0, 255, 127, 255, 0, 0.5, 0.5, 0.5);
ShowHudText(i, 5, "SERVER IP: %s", GetServerIP());
}
}
}
}
stock bool IsVIP(int client)
{
if (GetUserFlagBits(client) & ADMFLAG_RESERVATION || GetUserFlagBits(client) & ADMFLAG_GENERIC || GetUserFlagBits(client) & ADMFLAG_ROOT)return true;
else return false;
}
Any idea how to fix it? In my opinion the code is correct, I have no idea whats wrong.