Raised This Month: $12 Target: $400
 3% 

[REQ] How to bring XP to Decimal


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elmedin
Senior Member
Join Date: Nov 2013
Location: Bruh
Old 01-01-2015 , 05:38   [REQ] How to bring XP to Decimal
Reply With Quote #1

Who can tell me how to bring the XP on SH into the Decimal (i tried to do it but so much math >_<)
Decimal XP Example : 54.32%/100% (with percent )

Last edited by elmedin; 01-01-2015 at 05:38.
elmedin is offline
bat
Veteran Member
Join Date: Jul 2012
Old 01-01-2015 , 09:07   Re: [REQ] How to bring XP to Decimal
Reply With Quote #2

Code:
#include amxmodx

#define MAXLEVEL 10

new const LEVELS[MAXLEVEL] = 
{ 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 }

new xp[MAX_PLAYERS + 1], level[MAX_PLAYERS + 1]

public plugin_init()
    register_clcmd ("say test", "test")
	
public test(id){
    xp[id]++
    set_task(1.0, "mesage", id)
}

public mesage(id)
{
    if(level[id] == MAXLEVEL) return;
	
    while(xp[id] > LEVELS[level[id]])
    {
	    level[id]++
	    xp[id] = 0
    }	
    client_print(id, print_chat, "Percente: %.1f%%/%d%", 100.0 * xp[id] / (LEVELS[level[id]]), 100)	
}
__________________

Last edited by bat; 01-01-2015 at 09:07. Reason: delete one include
bat is offline
Send a message via Skype™ to bat
elmedin
Senior Member
Join Date: Nov 2013
Location: Bruh
Old 01-01-2015 , 11:20   Re: [REQ] How to bring XP to Decimal
Reply With Quote #3

Thanks so much but i need to delete to sma the client_print disabling it , right?
elmedin is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 01-10-2015 , 05:52   Re: [REQ] How to bring XP to Decimal
Reply With Quote #4

Yes
Bladell is offline
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 20:48.


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