Raised This Month: $ Target: $400
 0% 

How can i make ocixcrom level plugin to show 5,000/10,000Xp in hud?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-20-2021 , 15:04   Re: How can i make ocixcrom level plugin to show 5,000/10,000Xp in hud?
Reply With Quote #2

This would require messing with the main code (crx_ranksystem.sma).

Add this function somewhere in the code (e.g. in the bottom):

PHP Code:
// Credits to Bugsy
AddCommasiNum szOutput[] , iLen )
{
    new 
szTmp15 ] , iOutputPos iNumPos iNumLen;
    
    if ( 
iNum )
    {
        
szOutputiOutputPos++ ] = '-';
        
iNum absiNum );
    }
    
    
iNumLen num_to_striNum szTmp charsmaxszTmp ) );

    if ( 
iNumLen <= )
    {
        
iOutputPos += copyszOutputiOutputPos ] , iLen szTmp );
    }
    else
    {
        while ( ( 
iNumPos iNumLen ) && ( iOutputPos iLen ) ) 
        {
            
szOutputiOutputPos++ ] = szTmpiNumPos++ ];
        
            if( ( 
iNumLen iNumPos ) && !( ( iNumLen iNumPos ) % ) ) 
                
szOutputiOutputPos++ ] = ',';
        }
        
        
szOutputiOutputPos ] = EOS;
    }
    
    return 
iOutputPos;

Then find the "update_hudinfo" function (line 1442).
You'll see this piece of code:

Code:
if(has_argument(szMessage, ARG_CURRENT_XP)) {     num_to_str(g_ePlayerData[id][XP], szPlaceHolder, charsmax(szPlaceHolder))     replace_string(szMessage, charsmax(szMessage), ARG_CURRENT_XP, szPlaceHolder) }

This is how the XP is displayed - it converts the number into a string.
Simply change "num_to_str" to "AddCommas" and it should add commas to the number.

Do the same to the other portions of the code below this one - for ARG_NEXT_XP and ARG_XP_NEEDED.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
 



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 11:42.


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