[Include] OnPlayerScoreChange(playerid, newscore, oldscore); - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] OnPlayerScoreChange(playerid, newscore, oldscore); (
/showthread.php?tid=403017)
OnPlayerScoreChange(playerid, newscore, oldscore); -
dr.lozer - 28.12.2012
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!
Re: OnPlayerScoreChange(playerid, newscore, oldscore); -
dr.lozer - 30.12.2012
O.o wow i really suck :P
Re: OnPlayerScoreChange(playerid, newscore, oldscore); -
Cell_ - 31.12.2012
You sure do.
Why do you need ALS when you aren't even making a use to it?
P.S: You don't put it under OnGameModeInit() OR main(). Try to go through the basics before going advanced. Read the PAWN language guide.
Re: OnPlayerScoreChange(playerid, newscore, oldscore); -
JaKe Elite - 31.12.2012
Actually.
Why creating this?
a_state already have this kind of include.
However, different callback name but it works the same like this.
my a_state is created on December 22, 2012.
Yours is December 29, 2012.