SA-MP Forums Archive
Achievement 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: Achievement System (/showthread.php?tid=471277)



Achievement System - JaKe Elite - 22.10.2013

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?


Re: Achievement System - Kyance - 22.10.2013

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



Re: Achievement System - JaKe Elite - 23.10.2013

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.


Re: Achievement System - ejb - 23.10.2013

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


Re: Achievement System - JaKe Elite - 23.10.2013

I think this is what i want. thanks


Re: Achievement System - Zex Tan - 23.10.2013

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


Re: Achievement System - JaKe Elite - 24.10.2013

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.


Re: Achievement System - Godde - 08.03.2015

I want a cookie system too


AW: Re: Achievement System - Nero_3D - 08.03.2015

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


Re: Achievement System - biker122 - 08.03.2015

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