Achievement System
#1

Hello again.
This time it is about Achievement System.

I know how to do it, I just don't know how can i do it easily without doing it manually
like a Achievement for having 1000 score, I got many lines for score like Reaction Test, i've to put these lines one by one. I mean is there anyway to do the achievement system by timer or anything?

For ex.

I got 50 cookies, i will get

"Jake_Hero has achieve the "Cookie Master""

I got 1000 score, i will get

"Jake_Hero has achieve the "Score Master""

etc...

Is there anyway to do this?
Reply
#2

pawn Код:
public OnPlayerUpdate(playerid)
{
    new name[MAX_PLAYER_NAME+1], string[120+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[ACHIEVEMENT] %s is a 'Score Master' [1000 score]", name);
    if (GetPlayerScore(playerid) == 1000)
    {
    SendClientMessageToAll(COLOR_RED, string);
    SetPlayerScore(playerid, 1005); //To avoid spam message, couldn't find a way to fix it sadly
    format(string, sizeof(string), "[ACHIEVEMENT] %s has been rewarded.", name);
    SendClientMessageToAll(COLOR_RED, string);
    }
    return 1;
}
Reply
#3

that is bad idea and will spam if the score remains 1000.
EDIT: Just noticed, this bad idea, you just skip his score and add 5 to avoid spam.
Reply
#4

Try iPLEOMAX'S Achievement System: https://sampforum.blast.hk/showthread.php?tid=277706
Reply
#5

I think this is what i want. thanks
Reply
#6

Send the message when he received the 50 cookies. Like he got 49, won a cookie. Achievement get, show message.
Reply
#7

I didn't understand you and oh iPLEOMAX's achievement system is cool but that thing is not what i wanted, I need something like Achievement displaying how many things i achieve, Like listing all the things i achieve and hadn't achieve.
Reply
#8

I want a cookie system too
Reply
#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
#10

Consider trying my USF's update which contains an achievement system..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)