SA-MP Forums Archive
Need Help with Upgrade LEVEL system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need Help with Upgrade LEVEL system (/showthread.php?tid=284332)



Need Help with Upgrade LEVEL system - Jordan69 - 18.09.2011

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;
}



Re: Need Help with Upgrade LEVEL system - Jordan69 - 19.09.2011

Gah, anyone help please?


Re: Need Help with Upgrade LEVEL system - Jordan69 - 21.09.2011

Someone please?


Re: Need Help with Upgrade LEVEL system - Kingunit - 21.09.2011

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


Re: Need Help with Upgrade LEVEL system - Jordan69 - 23.09.2011

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.


Re: Need Help with Upgrade LEVEL system - GrimR - 23.09.2011

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.