AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=44)
-   -   [REQ] How to bring XP to Decimal (https://forums.alliedmods.net/showthread.php?t=254287)

elmedin 01-01-2015 05:38

[REQ] How to bring XP to Decimal
 
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 :D)

bat 01-01-2015 09:07

Re: [REQ] How to bring XP to Decimal
 
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)       
}


elmedin 01-01-2015 11:20

Re: [REQ] How to bring XP to Decimal
 
Thanks so much but i need to delete to sma the client_print disabling it , right?

Bladell 01-10-2015 05:52

Re: [REQ] How to bring XP to Decimal
 
Yes


All times are GMT -4. The time now is 18:04.

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