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
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 02-15-2022 , 10:43   Re: How can i make ocixcrom level plugin to show 5,000/10,000Xp in hud?
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
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.
This method doesn't work. I did exactly what you recommended, the .sma file got compiled without any errors or warnings, but there is still no comma.
GlobalPlague 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 11:42.


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