30.01.2011, 02:22
hi,
im trying to code a reaction test.
I wrote down 50 words and 2 words of them are random chosen + combined and displayed via SendClientMessage as soon as a test starts.
Nearly everything works except this:
The 2 words are combined and stored in the variable "answer" but i dont know how to check if the answer that has been typed in is correct?
Now i just get an argument type mismatch.
im trying to code a reaction test.
I wrote down 50 words and 2 words of them are random chosen + combined and displayed via SendClientMessage as soon as a test starts.
Nearly everything works except this:
The 2 words are combined and stored in the variable "answer" but i dont know how to check if the answer that has been typed in is correct?
Now i just get an argument type mismatch.
pawn Код:
new cmdr[100],idxr;
cmdr = strtok(cmdtext, idxr);
if (strcmp("/react", cmdr, true) == 0)
{
new tmp[256], cmdid, string[256], pname[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idxr);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /react [Answer]");
cmdid = strval(tmp);
if(!strval(answer,cmdr))//heres the problem
{
SendClientMessage(playerid, 0xAA3333AA, "The answer was not right!");
}
if(cmdid == answer && answered == 0)
{
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has won the Reaction Test!", pname);
SendClientMessageToAll(0xAA3333AA, string);
GivePlayerMoney(playerid, 2000);