08.03.2015, 01:43
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
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
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
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