[Include] OnPlayerScoreChange(playerid, newscore, oldscore);
#1

Hi, today i learned how to use this CallLocalFunction and Hooking

With this include you can do some cool things like this:

pawn Код:
public OnPlayerScoreChange(playerid, newscore, oldscore)
{
   if(newscore >= 100 && oldscore < 100) {
      GameTextForPlayer(playerid, "[]   Unlocked Rocket Luncher[]~n~Now you can use this weapon",4000,1);
   }
   return 1;
}
Include File:
well this is a small Include and i will not put in file and attach it... just copy paste it

just put this under of OnGameModeInit() or Main()
pawn Код:
forward OnPlayerChangeScore(playerid, newscore, oldscore);
new OldScore[MAX_PLAYERS];

stock SetPlayerScoreEx(playerid, score)
{
    OldScore[playerid] = GetPlayerScore(playerid);
    SetPlayerScore(playerid, score);
    return CallLocalFunction("OnPlayerChangeScore","iii",playerid, score, OldScore[playerid]);
}
   
#if defined _ALS_SetPlayerScore
    #undef SetPlayerScore
#else
    #define _ALS_SetPlayerScore
#endif

#define SetPlayerScore SetPlayerScoreEx
Now dont have your old SetPlayerScore Into SetPlayerScoreEx

it will automatically change by system

Код:
Thanks to() {
   ****** - Told me how to to hook and i learned using "is[128]" stuff from his sscanf function ( THANK YOU! )
   Dr.Lozer - for this include xD ;)
   return Rep++;
}
ENJOY!
Reply


Messages In This Thread
OnPlayerScoreChange(playerid, newscore, oldscore); - by dr.lozer - 28.12.2012, 18:08
Re: OnPlayerScoreChange(playerid, newscore, oldscore); - by dr.lozer - 30.12.2012, 17:16
Re: OnPlayerScoreChange(playerid, newscore, oldscore); - by Cell_ - 31.12.2012, 11:21
Re: OnPlayerScoreChange(playerid, newscore, oldscore); - by JaKe Elite - 31.12.2012, 11:30

Forum Jump:


Users browsing this thread: 1 Guest(s)