03.05.2014, 00:41
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:
Functions:
Examples:
Example of how to use the callbacks:
Example of how to change the delay between reactions:
Downloads:
Version 1.0.0:
Source A - Example Script, Include
Pastebin
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)
pawn Код:
SetReactionTimeDelay(time_delay)
ResetReactionTimer()
GetReactionTimeDelay()
GetReactionString()
IsReactionWon()
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;
}
Version 1.0.0:
Source A - Example Script, Include
Pastebin