Achievement System
#9

Just like Zex Tan already said, put the achievements check where you increase the variable (for score would be next to SetPlayerScore)

That would be an example for hooking SetPlayerScore
pawn Код:
static const
    ScoreAchieve[][] = {
        {500, "%s has achieve the \"Score Assistant\""},
        {1000, "%s has achieve the \"Score Master\""}
    }
;
static
    ScoreLevel[MAX_PLAYERS]
;
stock JaKe_SetPlayerScore(playerid, score) {
    if(SetPlayerScore(playerid, score)) { // online
        if(ScoreAchieve[ScoreLevel[playerid]][0] <= score) {
            new
                tmp[128]
            ;
            GetPlayerName(playerid, tmp, MAX_PLAYER_NAME);
            format(tmp, sizeof tmp, ScoreAchieve[ScoreLevel[playerid]][1], tmp);
            SendClientMessageToAll(0xFF0000FF, tmp);

            ScoreLevel[playerid]++;
        }
        return true;
    }
    return false;
}
#if defined _ALS_SetPlayerScore
    #undef SetPlayerScore
#else
    #define _ALS_SetPlayerScore
#endif
#define SetPlayerScore JaKe_SetPlayerScore
Something like that should be placed in an include because it needs to be above the other SetPlayerScore to work
To let it work you need to find the score level if the player joins (that would be 0) or if he logs in (the correct level) before you use SetPlayerScore
Reply


Messages In This Thread
Achievement System - by JaKe Elite - 22.10.2013, 09:53
Re: Achievement System - by Kyance - 22.10.2013, 10:54
Re: Achievement System - by JaKe Elite - 23.10.2013, 01:36
Re: Achievement System - by ejb - 23.10.2013, 01:56
Re: Achievement System - by JaKe Elite - 23.10.2013, 02:12
Re: Achievement System - by Zex Tan - 23.10.2013, 04:20
Re: Achievement System - by JaKe Elite - 24.10.2013, 06:25
Re: Achievement System - by Godde - 08.03.2015, 01:15
AW: Re: Achievement System - by Nero_3D - 08.03.2015, 01:43
Re: Achievement System - by biker122 - 08.03.2015, 04:37

Forum Jump:


Users browsing this thread: 1 Guest(s)