AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect something what was previous. (https://forums.alliedmods.net/showthread.php?t=89519)

xbatista 04-07-2009 13:09

Detect something what was previous.
 
Is that correct 0_0 ? ,I just need get Last/Old Level before giving him new one(PlayerLevel[id] += 1;).

PHP Code:

new LastLevel[33];

if(
PlayerXp[id] >= LEVELS[PlayerLevel[id]]) // Checks level/Level up.
{
     
PlayerLevel[id] += 1;
}
else if (
PlayerXp[id] < LEVELS[PlayerLevel[id]])
{
    
LastLevel[id] = PlayerLevel[id]



Dores 04-07-2009 13:25

Re: Detect something what was previous.
 
Just as a note, you need to find a way to know if the player should level up 1 level or more than 1, according to his exp. If his exp is bigger than the XP needed for few levels above him, he will only level up 1 level...

About saving last level, just save his current level before adding levels to it.

PHP Code:

if(PlayerXP[id] >= LEVELS[PlayerLevel[id]])
{
    
LastLevel[id] = PlayerLevel[id];
    
PlayerLevel[id] += // number of levels he should gain.



xbatista 04-07-2009 13:28

Re: Detect something what was previous.
 
Quote:

Just as a note, you need to find a way to know if the player should level up 1 level or more than 1, according to his exp.
PHP Code:

if(PlayerXP[id] >= LEVELS[PlayerLevel[id]])
{
    
LastLevel[id] = PlayerLevel[id];
    
PlayerLevel[id] += // number of levels he should gain.


Thanks ;)

Dores 04-07-2009 14:47

Re: Detect something what was previous.
 
You can do this:

PHP Code:

// Make sure he's not at the highest level.
if(PlayerLevel[id] < sizeof (LEVELS))
{
    while(
PlayerXP[id] >= LEVELS[PlayerLevel[id]])
    {
        
PlayerLevel[id]++;
    }




All times are GMT -4. The time now is 02:25.

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