Raised This Month: $ Target: $400
 0% 

Solved HUD not being displayed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-28-2018 , 13:09   HUD not being displayed
Reply With Quote #1

I'm trying to fix this for hours and I still don't get why I'm not seeing a HUD getting displayed. The function that triggers the HUD is called on Ham_Killed but it still persists to not display.
PHP Code:
public @HamKilled_PostiVictimiAttackeriShouldGib )
{
    if( 
g_bHasGameStarted )
    {
        if( 
GetTeamAlivePlayersGetPlayerTeamiVictim ) ) == // all his teammates are dead
        
BetterLuckNextTimeiVictim ); // he lost the round
    
}
}

BetterLuckNextTimeiPlayer )
{
    
set_hudmessage025500.300.3000.010.0 );
    
show_hudmessageiPlayer"Your team placed: #%d", ( GetRemainingTeams( ) + ) );
    
    if( 
GetPlayerPerTeam( ) > )
    {
        new 
szPlayers32 ], iNumiTempID;
        
get_playersszPlayersiNum"bch" );
        
        for( new 
iiNumi++ )
        {
            
iTempID szPlayers];
            
            if( ( 
GetPlayerTeamiTempID ) == GetPlayerTeamiPlayer ) ) && ( iTempID != iPlayer ) )
            {
                
set_hudmessage025500.350.3500.010.0 );
                
show_hudmessageiTempID"Your team placed: #%d", ( GetRemainingTeams( ) + ) );
            }
        }
    }

I just don't get what would cause it to not be displayed..
__________________

Last edited by edon1337; 07-17-2018 at 08:31.
edon1337 is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-28-2018 , 15:23   Re: HUD not being displayed
Reply With Quote #2

What does GetRemainingTeams() return ?

EDIT: I tested with your exact code, It works, except I hardcoded the GetRemainingTeams( ) return, so check that function. ( Either that, or its not called at all )
__________________
stuff

Last edited by maqi; 06-28-2018 at 15:39.
maqi is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-28-2018 , 18:17   Re: HUD not being displayed
Reply With Quote #3

Quote:
Originally Posted by maqi View Post
What does GetRemainingTeams() return ?

EDIT: I tested with your exact code, It works, except I hardcoded the GetRemainingTeams( ) return, so check that function. ( Either that, or its not called at all )
It returns the number of teams left.

I debugged the code and this is sooo weird, how can #2 be logged first when #1 executes it?

CODE:
PHP Code:
public @HamKilled_PostiVictimiAttackeriShouldGib )
{
    if( 
g_bHasGameStarted )
    {
        if( 
GetTeamAlivePlayersGetPlayerTeamiVictim ) ) == )
        {
            
BetterLuckNextTimeiVictim );
            
log_to_file"csbattleroyale.txt""#1 Called | iVictim = %d"iVictim );
        }
    }
}

BetterLuckNextTimeiPlayer )
{
    
log_to_file"csbattleroyale.txt""#2 Called | iPlayer = %d"iPlayer );

    
set_hudmessage025500.350.3500.010.0 );
    
show_hudmessageiPlayer"Your team placed: #%d", ( GetRemainingTeams( ) - ) );

    new 
szPlayers32 ], iNumiTempID;
    
get_playersszPlayersiNum );
    
    for( new 
iiNumi++ )
    {
        
iTempID szPlayers];
        
        if( ( 
GetPlayerTeamiTempID ) == GetPlayerTeamiPlayer ) ) && ( iTempID != iPlayer ) )
        {
            
set_hudmessage025500.350.3500.010.0 );
            
show_hudmessageszPlayers], "Your team placed: #%d", ( GetRemainingTeams( ) + ) );
            
            
log_to_file"csbattleroyale.txt""#3 Called | Remaining Teams: %d"GetRemainingTeams( ) );
        }
    }

DEBUG LOGS:
Quote:
L 06/29/2018 - 00:13:55: #2 Called | iPlayer = 1
L 06/29/2018 - 00:13:55: #3 Called | Remaining Teams: 1
L 06/29/2018 - 00:13:56: #3 Called | Remaining Teams: 1
L 06/29/2018 - 00:13:56: #3 Called | Remaining Teams: 1
L 06/29/2018 - 00:13:56: #1 Called | iVictim = 1
__________________

Last edited by edon1337; 06-29-2018 at 06:33.
edon1337 is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 06:12   Re: HUD not being displayed
Reply With Quote #4

It's executed in the right order.

PHP Code:
BetterLuckNextTimeiVictim );   // first
log_to_file"csbattleroyale.txt""#1 Called | iVictim = %d"iVictim );  //second 
Also a few things, if I may:
- You are showing ( GetRemainingTeams( ) - 1 ) to the player but ( GetRemainingTeams( ) + 1 ) to his team ( Im not sure if this is intended, but doesn't seem right )
- Don't use szPlayers[ i ] if you already defined iTempID, or don't use iTempID at all
- And I would suggest adding some flags to the get_players native, as you don't need a hud message to be shown to bots for example, or even alive players in this case.

As for the hud not showing ( if it still isn't ), can we please take a look at the GetRemainingTeams() ?
__________________
stuff

Last edited by maqi; 06-29-2018 at 06:21.
maqi is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 06:32   Re: HUD not being displayed
Reply With Quote #5

Quote:
Originally Posted by maqi View Post
It's executed in the right order.

PHP Code:
BetterLuckNextTimeiVictim );   // first
log_to_file"csbattleroyale.txt""#1 Called | iVictim = %d"iVictim );  //second 
Yes, my bad, I didn't notice

Quote:
Originally Posted by maqi View Post
- You are showing ( GetRemainingTeams( ) - 1 ) to the player but ( GetRemainingTeams( ) + 1 ) to his team ( Im not sure if this is intended, but doesn't seem right )
I have already fixed it since last night

Quote:
Originally Posted by maqi View Post
- Don't use szPlayers[ i ] if you already defined iTempID, or don't use iTempID at all
Doesn't really fix this bug but you're right, I was in a rush when I edited the code so I missed that.

Quote:
Originally Posted by maqi View Post
- And I would suggest adding some flags to the get_players native, as you don't need a hud message to be shown to bots for example, or even alive players in this case.
If I add the flag to skip dead players how would I loop through his dead teammates?

Quote:
Originally Posted by maqi View Post
As for the hud not showing ( if it still isn't ), can we please take a look at the GetRemainingTeams() ?
It was showing like 30 mins ago now It's gone again, idk what's causing it to not show sometimes..

As I said, it just returns an integer.
PHP Code:
GetRemainingTeams( )
{
    new 
iRemainingTeams;

    for( new 
iTeam 1iTeam <= GetMaxTeams( ); iTeam++ )
    {
        if( 
GetTeamAlivePlayersiTeam ) >= // GetTeamAlivePlayers returns number of alive players in a team
        
{
            
iRemainingTeams++;
        }
    }
    return 
iRemainingTeams;

__________________

Last edited by edon1337; 06-29-2018 at 06:34.
edon1337 is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 06-29-2018 , 06:41   Re: HUD not being displayed
Reply With Quote #6

You don't need a flag to skip dead, you need a flag to skip alive As I can see, you are never going to show this message to an alive player. so go with
Code:
get_players ( iPlayers, iNum, "bch" );

Anyway, I don't really know about the hud not showing, everything is pointing to the GetRemainingTeams halting or returning a non integer value ( Which doesn't seem to be a case here ), however the code above doesn't help us debug because it's even more functions inside one another Id suggest going through all of those to look for errors ( Especially if it shows hud sometimes )

Other than that, check for some other hud message overwriting the same channel.
__________________
stuff
maqi is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 06-29-2018 , 07:09   Re: HUD not being displayed
Reply With Quote #7

Quote:
Originally Posted by maqi View Post
You don't need a flag to skip dead, you need a flag to skip alive As I can see, you are never going to show this message to an alive player. so go with
Code:
get_players ( iPlayers, iNum, "bch" );
Yeah, I misunderstood what you said, that would work, thanks.

Quote:
Originally Posted by maqi View Post
Other than that, check for some other hud message overwriting the same channel.
I also think that might be the case, I already used -1 channel so it automatically finds a new channel, so they don't overwrite each other, but it's not working.

EDIT: Client_print works, but not HUDs..

PHP Code:
BetterLuckNextTimeiPlayer )
{
    
set_hudmessage025500.300.3000.010.0__, -);
    
show_hudmessageiPlayer"Your team placed: #%d", ( GetRemainingTeams( ) + ) );

    
client_printiPlayerprint_center"Your team placed: #%d", ( GetRemainingTeams( ) + ) );
    
    if( 
GetPlayerPerTeam( ) > )
    {
        new 
szPlayers32 ], iNumiTempID;
        
get_playersszPlayersiNum"bch" );
        
        for( new 
iiNumi++ )
        {
            
iTempID szPlayers];
            
            if( ( 
GetPlayerTeamiTempID ) == GetPlayerTeamiPlayer ) ) && ( iTempID != iPlayer ) )
            {
                
set_hudmessage025500.350.3500.010.0__, -);
                
show_hudmessageiTempID"Your team placed: #%d", ( GetRemainingTeams( ) + ) );
            }
        }
    }

__________________

Last edited by edon1337; 06-29-2018 at 07:15.
edon1337 is offline
Old 06-29-2018, 09:01
Relaxing
This message has been deleted by HamletEagle. Reason: Stop with trolling already. If you can't help then don't post.
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-01-2018 , 04:25   Re: HUD not being displayed
Reply With Quote #9

Have you tried debugging to see what gets called or not?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-01-2018 , 06:35   Re: HUD not being displayed
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
Have you tried debugging to see what gets called or not?
Yes, check post #3
__________________
edon1337 is offline
Reply


Thread Tools
Display Modes

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 12:35.


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