AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Levels in XP TUT (https://forums.alliedmods.net/showthread.php?t=117957)

Zombiezzz 02-06-2010 13:46

Levels in XP TUT
 
in the XP TUT, whats the best way to amke it so when a player levels up it tells them a rank. Like for level 1 "Your rank is pravite!"
PHP Code:

new const LEVELS[6] = {
    
0,
    
50
    
100
    
200
    
350,
    
550



wrecked_ 02-06-2010 13:50

Re: Levels in XP TUT
 
something like
PHP Code:

 if( your_parameters_to_find_if_he_leveledid ) ) {
LEVELS[id]++

new 
level LEVELS[id]

switch( 
level )
{
   case 
1: {
        
client_printidprint_chat"You're a private!" )
   }
   case 
2: { 

That kind of thing. I highly doubt that code will work, but make a switch for when they level to get what level they are, and then set a message for when they level. There are many other ways to do this.

minimiller 02-06-2010 13:51

Re: Levels in XP TUT
 
like this i presume

PHP Code:

new gszRanks[][] = 
{
    
"Private",
    
"General",
    
"etc.",
    
"",
    
"",
    
""
};

//...
public level_up(id)
{
    
client_print(idprint_chat"Your rank is %s"gszRank[giLevel[id]]);
    
//You will need to replace giLevel with the var that holds each players level



wrecked_ 02-06-2010 13:54

Re: Levels in XP TUT
 
Quote:

Originally Posted by minimiller (Post 1080551)
like this i presume

PHP Code:

new gszRanks[][] = 
{
    
"Private",
    
"General",
    
"etc.",
    
"",
    
"",
    
""
};

//...
public level_up(id)
{
    
client_print(idprint_chat"Your rank is %s"gszRank[giLevel[id]]);
    
//You will need to replace giLevel with the var that holds each players level



This one works much better and more efficiently. Use mini's.

Zombiezzz 02-06-2010 14:15

Re: Levels in XP TUT
 
thank you all for your help


All times are GMT -4. The time now is 07:27.

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