Raised This Month: $51 Target: $400
 12% 

Solved [CSGO] HUD problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ahmed_Nakadi
Member
Join Date: Oct 2018
Old 10-04-2020 , 13:09   [CSGO] HUD problems
Reply With Quote #1

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.0HUD_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(NetIPsizeof(NetIP), "%d.%d.%d.%d:%d"pieces[0], pieces[1], pieces[2], pieces[3], FindConVar("hostport").IntValue);
    return 
NetIP;
}

public 
Action HUD(Handle timerint client)
{        
    
    
    for (new 
1<= MaxClientsi++)  
    {  
             if (
IsClientInGame(i))  
            {  
                    if(
IsVIP(i))
                    {
                        return 
Plugin_Continue;
                        
                    }
                    else
                    {
                        
SetHudTextParams(-0.805.0025512725500.50.50.5);   
                        
ShowHudText(i5"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.

Last edited by Ahmed_Nakadi; 10-04-2020 at 15:08.
Ahmed_Nakadi is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-04-2020 , 14:07   Re: [CSGO] HUD problems
Reply With Quote #2

Quote:
Originally Posted by Ahmed_Nakadi View Post
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.0HUD_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(NetIPsizeof(NetIP), "%d.%d.%d.%d:%d"pieces[0], pieces[1], pieces[2], pieces[3], FindConVar("hostport").IntValue);
    return 
NetIP;
}

public 
Action HUD(Handle timerint client)
{        
    
    
    for (new 
1<= MaxClientsi++)  
    {  
             if (
IsClientInGame(i))  
            {  
                    if(
IsVIP(i))
                    {
                        return 
Plugin_Continue;
                        
                    }
                    else
                    {
                        
SetHudTextParams(-0.805.0025512725500.50.50.5);   
                        
ShowHudText(i5"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.
Change
PHP Code:
return Plugin_Continue
To
PHP Code:
continue; 
__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
Ahmed_Nakadi
Member
Join Date: Oct 2018
Old 10-04-2020 , 15:07   Re: [CSGO] HUD problems
Reply With Quote #3

its working, thanks a lot
Ahmed_Nakadi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode