Raised This Month: $32 Target: $400
 8% 

# XP out of # XP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ardonicek
Senior Member
Join Date: Feb 2013
Location: My home
Old 08-24-2013 , 13:17   # XP out of # XP
Reply With Quote #1

Hello, i have XP mod:



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)

__________________
Latest plugin: dHUD Round | Timeleft
Ardonicek is offline
Send a message via ICQ to Ardonicek Send a message via Skype™ to Ardonicek
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-24-2013 , 13:41   Re: # XP out of # XP
Reply With Quote #2

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.
__________________

Last edited by Black Rose; 08-24-2013 at 13:42.
Black Rose is offline
Ardonicek
Senior Member
Join Date: Feb 2013
Location: My home
Old 08-24-2013 , 13:49   Re: # XP out of # XP
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
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"
__________________
Latest plugin: dHUD Round | Timeleft

Last edited by Ardonicek; 08-24-2013 at 13:53.
Ardonicek is offline
Send a message via ICQ to Ardonicek Send a message via Skype™ to Ardonicek
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 08-26-2013 , 09:32   Re: # XP out of # XP
Reply With Quote #4

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.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Reply


Thread Tools
Display Modes

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 08:42.


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