Raised This Month: $ Target: $400
 0% 

Required_kills_for_next_level


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-12-2010 , 09:15   Re: Required_kills_for_next_level
Reply With Quote #8

Here's another method which allows a Min\Max range for each rank. Also included is a SetRank function which will assign a rank to a player based on his XP points.

PHP Code:
//Constants for each rank, easier to use than number ranks
enum Ranks
{
    
Noob// 0
    
Rookie// 1
    
Good// 2
    
Best// 3
    
Pro // 4
}

//XP/point ranges for each rank.
new const RankXPRanks ][ ] = 
{
    {   
100 }, //Noob 0-100 pts
    
101 200 }, //Rookie 101-200 pts
    
201 300 }, //Good 201-300 pts
    
301 400 }, //Best 301-400 pts
    
401 999999999 //Pro 401+ pts
}

//This is used only to print/display the rank a player currently has.
new const RankNameRanks ][] = 
{
    
"Noob",
    
"Rookie",
    
"Good",
    
"Best",
    
"Pro"
}

//Create 2 arrays, g_XP[] is the number of XP points each player has;
//g_PlayerRank is the players current Rank (assigned by SetRank function)
new g_XP33 ] , Ranks:g_PlayerRank33 ];

public 
SetRankid 
{
    
//Loop through all of our ranks (See above enum)
    
for ( new Ranks:Noob <= Pro i++ )
    {
        
//Check if player is in current rank, suppose the player had 320 XP pts, this 
        //condition would be met at Pro rank since the XP range is 301-400. 
        // if ( 301 <= 320 <= 400 ) would be true so we assign Pro rank to player.
        
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-12-2010 at 09:22.
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 05:25.


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