Level Up system
#1

I'm creating a gang turf system which features a level system and an experience system. Every 50+ turf xp, The turf levels up (Example; If the turf is level 0 and it has 50 XP, It will level up to level 1. If the turf is level 1 and it has 100 XP, it will level up and so on) I am not sure if I am doing right at the >= 0 and <= 10 part though I'm pretty sure I'm doing good with the rest of the code below it.

My aim with the code is that the script will only function when the turf level is 0 - 10, once it reached the maximum level which is 10. The code will no longer work.

PHP код:
if((GangTurf[x][turfLevel] >= && GangTurf[x][turfLevel] <= 10) && GangTurf[x][turfXP] >= (GangTurf[x][turfLevel] + 1) * 50)
{
    
GangTurf[x][turfLevel] += 1;
    
GetTurfLocation(xzone28);
    
format(stringsizeof(string), "* Your turf at %s is now level %d. (Total XP: %s)"GangTurf[x][turfLevel], AddComma(GangTurf[x][turfXP]));
    
SendTeamMessage(GangTurf[x][turfOwner], GetTeamColor(GangTurf[x][turfOwner]), string);
    switch(
GangTurf[x][turfSpecial])
    {
        case 
1// Cash Generation
        
{
            
format(stringsizeof(string), "HINT: Cash Generation has increased, Your turf will now receive $%d per minute.", (GangTurf[x][turfLevel] + 1) * 50);
            
SendTeamMessage(GangTurf[x][turfOwner], -1string);
        }
    }

Reply
#2

If I understood you correctly, make an array to hold the specific EXP for the levels.

PHP код:
// I am sure you have defined the max turf/level at least. 
new g_TurfLevelEXP[MAX_TURFLEVEL] = { 050100200, ... }; 
So the level 0 holds 0 EXP, level 1 holds 50, level 2 holds 100 and so on. And you can grab the level EXP by indexing a player's turf ID in this array, I assume it's the GangTurf[x][turfLevel]. I am not quite sure how your turf system works, but I think this will give you an idea at least.
Reply
#3

PHP код:
if((GangTurf[x][turfLevel] >= && GangTurf[x][turfLevel] <= 11) && GangTurf[x][turfXP] >= (GangTurf[x][turfLevel] + 1) * 50

    
GangTurf[x][turfLevel] += 1
    
GetTurfLocation(xzone28); 
    
format(stringsizeof(string), "* Your turf at %s is now level %d. (Total XP: %s)"GangTurf[x][turfLevel], AddComma(GangTurf[x][turfXP])); 
    
SendTeamMessage(GangTurf[x][turfOwner], GetTeamColor(GangTurf[x][turfOwner]), string); 
    switch(
GangTurf[x][turfSpecial]) 
    { 
        case 
1// Cash Generation 
        

            
format(stringsizeof(string), "HINT: Cash Generation has increased, Your turf will now receive $%d per minute.", (GangTurf[x][turfLevel] + 1) * 50); 
            
SendTeamMessage(GangTurf[x][turfOwner], -1string); 
        } 
    } 

If I am not mistaken, this will work.
Reply
#4

Quote:
Originally Posted by Sjn
Посмотреть сообщение
If I understood you correctly, make an array to hold the specific EXP for the levels.
Really? It's just a linear curve; required xp = level * 50.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)