View Single Post
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