Raised This Month: $ Target: $400
 0% 

(help) HudSyncObject error


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-06-2016 , 10:51   Re: (help) HudSyncObject not work
Reply With Quote #6

This will show the players own data while alive, or spectated player info when dead. You will need to add PLAYERNAME to your language file. You also need to include fakemeta if you do not use it already.

See comments:
PHP Code:
public Info()
{
    new 
iPlayers32 ] , iNum len id iPlayerToShow szName33 ];
    static 
buffer192 ];
    
    
//Get all players who are connected and are not bots or HLTV
    
get_playersiPlayers iNum "ch" );
    
    
//Loop through these players
    
for( new iNum i++ )
    {
        
id iPlayers];
        
        
//If self is alive then use self player id. If not alive, use spectated player id (pev_iuser2)
        
iPlayerToShow is_user_aliveid ) ? id pevid pev_iuser2 );
        
        
//If iPlayerToShow is self OR iPlayerToShow is not self and iPlayerToShow is alive
        
if ( ( id == iPlayerToShow ) || is_user_aliveiPlayerToShow ) )
        {
            
//iPlayerToShow is not self, so get players name to we know who is being spectated. 
            //If iPlayerToShow is self then name is not retrieved.
            
if ( iPlayerToShow != id )
            {
                
get_user_nameiPlayerToShow szName charsmaxszName ) );
                
len formatexbuffer charsmaxbuffer ) , "%L %s^n" LANG_PLAYER "PLAYERNAME" szName );
            }
            
            
len += formatexbufferlen ], charsmaxbuffer ), "%L" LANG_PLAYER ,"RANK" );
            
            if ( 
PlayerLeveliPlayerToShow ] <= 18 )
            {
                
needXPid ] = LEVELSPlayerLeveliPlayerToShow ] ] - PlayerXPiPlayerToShow ];
                
len += formatexbufferlen ] , charsmaxbuffer ) - len " %L" LANG_PLAYER RANKSPlayerLeveliPlayerToShow ] ] );
                
len += formatexbufferlen ] , charsmaxbuffer ) - len "^n%L %d" LANG_PLAYER "PL_XP" PlayerXPiPlayerToShow ] );
                
len += formatexbufferlen ] , charsmaxbuffer ) - len "^n%L %d" LANG_PLAYER "NEXT_LVL" needXPiPlayerToShow ] );
                
len += formatexbufferlen ] , charsmaxbuffer ) - len "^n%L" LANG_PLAYER "FRAGS" );
            } 
            else 
            {
                
len += formatexbufferlen ] , charsmaxbuffer ) - len " %L" LANG_PLAYER RANKSPlayerLeveliPlayerToShow ] ] );
                
len += formatexbufferlen ] , charsmaxbuffer ) - len "^n%L" LANG_PLAYER "PL_MAX" );
            }
            
            
set_hudmessage255 255 255 0.01 0.13 0.0 1.0 __, -);
            
ShowSyncHudMsgid g_MsgHud buffer );
        }
    }

__________________

Last edited by Bugsy; 02-06-2016 at 20:58.
Bugsy is offline
 



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 09:29.


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