23.09.2015, 14:44
So i am using this reaction test in my trucking gamemode,it works but when rewarding the player when he does the reaction test,it gives him the money and removes it.How to fix this? TNX who helps in advance.
PHP код:
#include <a_samp>
#define COL_RED "{F81414}"
#define COL_GREEN "{6EF83C}"
#define COLOR_ORANGE 0xAA3333AA
#define VRIJEMEP 5 // Number of minutes for how to run the test
#define NAJMANJI_BROJ 2000000 //Must be at least
#define NAJVECI_BROJ 8000000 //The maximum number.
#define NAGRADA_ZA_POBEDNIKA 2500 // You can change the prize
forward NewTest(); //for new test
forward TacanOdgovor(playerid); //for test winner
new BROJ = -1; //Minus 1 (-1).
public OnFilterScriptInit()
{
SetTimer("NewTest",(1000*60*VRIJEMEP),1); // Timer Minutes
return 1;
}
public NewTest()
{
new string[128]; //Creating a string to run the numbers and print it.
BROJ = NAJMANJI_BROJ + random(NAJVECI_BROJ-NAJMANJI_BROJ);
/* CorrectNumber: number what he must type
NAJMANJI_BROJ;NAJVECI_BROJ: The smallest possible number, that number should be typed does not go below
**** 'random' Selects any number between mass and Min values.
*/
format(string,sizeof string,"{F81414}New test reaction is started. %d gets $%d.",BROJ,NAGRADA_ZA_POBEDNIKA);
SendClientMessageToAll(0xAA3333AA,string); //
}
public OnPlayerText(playerid,text[])
{
if(strval(text) == BROJ && BROJ != -1) // checking is answer correct
{
TacanOdgovor(playerid);
}
return 1;
}
public TacanOdgovor(playerid)
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof pName); // Name of winner
format(string,sizeof string,"{F81414}Player %s,{F81414}won the test reactions and wins %d! ,",pName,NAGRADA_ZA_POBEDNIKA);
SendClientMessageToAll(0xAA3333AA,string);
GivePlayerMoney(playerid,NAGRADA_ZA_POBEDNIKA);
BROJ = -1;
return 1;
}