Raised This Month: $ Target: $400
 0% 

How to Add level a rank?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2010 , 20:16   Re: How to Add level a rank?
Reply With Quote #1

This will set a players rank based on the number of XP points. ie., if a player has 250 XP points, he would be assigned to Good rank.
PHP Code:
enum Ranks
{
    
Noob,
    
Rookie,
    
Good,
    
Best,
    
Pro
}

new const 
RankXPRanks ][ ] = 
{
    {   
100 }, //Noob
    
101 200 }, //Rookie
    
201 300 }, //Good
    
301 400 }, //Best
    
401 999999999 //Pro
}

new const 
RankNameRanks ][] = 
{
    
"Noob",
    
"Rookie",
    
"Good",
    
"Best",
    
"Pro"
}

new 
g_XP33 ] , Ranks:g_PlayerRank33 ];

public 
SetRankid 
{
    for ( new 
Ranks:Noob <= Pro i++ )
    {
        if ( 
RankXP][ ] <= g_XPid ] <= RankXP][ ] )
        {
            
g_PlayerRankid ] = i;
            break;
        }
    }

    
client_printprint_chat "XP=%d Rank=%s" g_XPid ] , RankNameg_PlayerRankid ] ] );  

__________________

Last edited by Bugsy; 06-03-2010 at 08:54.
Bugsy 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 05:24.


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