Need Help with Upgrade LEVEL system
#1

I wanna make it so people need to play atleast 8 hours per level, and it will take 25k per level, so each level, it raises up by 25k and 8 more hours till next level, here is my code.

pawn Код:
CMD:upgradelevel(playerid, params[]) {
    /* 1 level costs Level x min_level_upgrade_cost */
    if(playerVariables[playerid][pBankMoney] >= playerVariables[playerid][pLevel] + 1 * assetVariables[3][aAssetValue] && playerVariables[playerid][pBankMoney] > 0) {
        if(playerVariables[playerid][pLevel] >= 10)
            return SendClientMessage(playerid, COLOR_GREY, "You're at the maximum level.");

        if(FetchLevelFromHours(playerVariables[playerid][pPlayingHours]) == playerVariables[playerid][pLevel])
            return SendClientMessage(playerid, COLOR_GREY, "You can't upgrade your level yet.");

        playerVariables[playerid][pLevel] += 1;
        playerVariables[playerid][pBankMoney] -= playerVariables[playerid][pLevel] + 1 * assetVariables[3][aAssetValue];

        SetPlayerScore(playerid, playerVariables[playerid][pLevel]);
    }
    return 1;
}
Reply
#2

Gah, anyone help please?
Reply
#3

Someone please?
Reply
#4

What is exactly the problem. Put some information in your thread.
Reply
#5

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
What is exactly the problem. Put some information in your thread.
There really is no problem, I just need help making it better, as I stated.
Reply
#6

You will need a variable in with your main player data (presumably your using an enum or some such) and from what I have seen using a timer is the easiest way.

SetTimerEx will let you call a function of your choice and define whether you want it looped indefinitely or not (check samp wiki for full details on this).

My idea is to store server time every login, check within the function called by the timer (every 30mins/1 hour etc) if they have been on long enough to qualify for getting an upgrade point, paycheck or what ever you like.

Your upgrade command would obviously just check this variable of upgrade points, based on current level to see if they qualify (e.g. If 8 * UserLevel == UserPoints) then they can upgrade), as for money it's just 25 * UserLevel, pretty simple in your case.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)