14.07.2016, 10:42
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.
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] >= 0 && GangTurf[x][turfLevel] <= 10) && GangTurf[x][turfXP] >= (GangTurf[x][turfLevel] + 1) * 50)
{
GangTurf[x][turfLevel] += 1;
GetTurfLocation(x, zone, 28);
format(string, sizeof(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(string, sizeof(string), "HINT: Cash Generation has increased, Your turf will now receive $%d per minute.", (GangTurf[x][turfLevel] + 1) * 50);
SendTeamMessage(GangTurf[x][turfOwner], -1, string);
}
}
}