AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   # XP out of # XP (https://forums.alliedmods.net/showthread.php?t=224445)

Ardonicek 08-24-2013 13:17

# XP out of # XP
 
Hello, i have XP mod:
http://screenshot.cz/JAL0Z/2013-08-24_00004.jpg


And i need help with it.
I want to see, how many XP do i need to LVL.
Just like: [XP: 99999/100000]

Here is a part of code, to show HUD.

PHP Code:

public ShowHud(id

    new 
szText[555 char]  
    { 
        
formatex(szTextsizeof(szText) -1"[%s]^n[XP : %i]^n[Buy XP = /buyxp]"Prefix[Level[id]], eXP[id]) 
    } 
    
set_hudmessage(168226180.010.2005.010.05.0_1)
    
show_hudmessage(idszText)



Black Rose 08-24-2013 13:41

Re: # XP out of # XP
 
formatex(szText, sizeof(szText) -1, "[%s]^n[XP : %i/%i]^n[Buy XP = /buyxp]", Prefix[Level[id]], eXP[id], VariableThatContainsXPForAllLevels[ Level[id] + 1 ])

There's a macro called charsmax() replacing sizeof()-1.

Ardonicek 08-24-2013 13:49

Re: # XP out of # XP
 
Quote:

Originally Posted by Black Rose (Post 2020762)
formatex(szText, sizeof(szText) -1, "[%s]^n[XP : %i/%i]^n[Buy XP = /buyxp]", Prefix[Level[id]], eXP[id], VariableThatContainsXPForAllLevels[ Level[id] + 1 ])

There's a macro called charsmax() replacing sizeof()-1.


PHP Code:

#define MaxLevels 200
new const Levels[MaxLevels] =  

    
15,
    
40
    
75
    
130
    
200,  
    
300,
    
450
    
650
    
1000,
    
1500

This is part of code with const Levels[MaxLevels]

Should it be like that?

PHP Code:

formatex(szTextsizeof(szText) -1"[%s]^n[XP : %i/%i]^n[Kupenie XP = /buyxp]"Prefix[Level[id]], eXP[id], LevelsLevel[id] + ]) 



//EDIT : WORKS!

Now i need to know how to construct the code "on level up".

Just like on lvl up = say "player has leveled up to 50"

~Ice*shOt 08-26-2013 09:32

Re: # XP out of # XP
 
PHP Code:

public Event_DeathMsg()
{
    new 
Attacker read_data(1)
    new 
Victim read_data(2)

    if (
Victim != Attacker)
    {
        if (
PlayerLevel[Attacker] < MaxLevel 1)
        {
            new 
Name[32]
            
get_user_name(idNamecharsmax(Name))

            if (
PlayerXP[id] >= Levels[PlayerLevel[id]])
            {
                
client_print(03"%s Reached Level %d!"NamePlayerLevel[id])
            }
        }
    }


something like this, it will be simpler if you post your code.. anyway feel free to edit this, and don't forget to register event.


All times are GMT -4. The time now is 11:56.

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