[Include] DReactions - 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] DReactions (
/showthread.php?tid=510893)
DReactions -
DeStunter - 03.05.2014
Introduction:
Hello, I have been working on a server for a while now, and I also like to contribute work to the community. So I decided to make up a Include for reaction tests. Bassically it will generate a string between x and x characters long. The system is setup to create the reaction and then call a function where you can announce and make a prize what ever you want. When someone wins the reaction it will call function which sends the players id that won. There you can announce it and reward a prize.
Callbacks:
pawn Код:
public OnNewReaction(reaction[])
public OnReactionWon(playerid)
Functions:
pawn Код:
SetReactionTimeDelay(time_delay)
ResetReactionTimer()
GetReactionTimeDelay()
GetReactionString()
IsReactionWon()
Examples:
Example of how to use the callbacks:
pawn Код:
new string[128];
public OnNewReaction(reaction[])
{
format(string, sizeof(string), ">> First person to type %s wins $500!", reaction);
SendClientMessageToAll(0xCCFF00, string);
printf("%s", string);
return 1;
}
public OnReactionWon(playerid)
{
new p_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, p_name, sizeof(p_name));
GivePlayerMoney(playerid, 500);
format(string, sizeof(string), ">> %s has won the reaction test, and won $500!", p_name);
SendClientMessageToAll(0xCCFF00, string);
return 1;
}
Example of how to change the delay between reactions:
pawn Код:
public OnGameModeInit()
{
SetReactionTimeDelay((2 * 60 * 1000)); //2 minutes. reaction delay is in ms
ResetReactionTimer();
return 1;
}
Downloads:
Version 1.0.0:
Source A - Example Script, Include
Pastebin
Re: DReactions -
AiRaLoKa - 03.05.2014
look similiar with
RyDeR`'s reaction test
Re: DReactions -
DeStunter - 03.05.2014
Quote:
Originally Posted by AiRaLoKa
look similiar with RyDeR`'s reaction test
|
similar idea, but the code is completely different. Look for your self. I also created this knowing that its a decently old idea and its been posted before. Mine is just a different way of accomplishing the same goal. I just wanted to make it like a library that can be included and all the server owners have the options of saving reaction times, reactions won, rewards as the library will call those 2 callbacks in your script which you could say are like events. An event when a reaction has been generated, and a event when someone has won the reaction.