25.10.2009, 16:48
Hi! I got this reaction test script from the internet. However,just like other internet releases, it doesnt work! Here is the code...
At the top:
OnGameModeInIt
Why wont this work? I get no errors, but, when i enter the word, it doesnt work! If you can help me fix this or right an alternative to this, i'd be really thnkful!
Thnk you!
Here is the pastebin link...
http://pastebin.com/m5d81107a
P.S Peter, i put your name at the top because your the guy I know that can splve this... But if anyone lse wants a go, there is nothing stopping you :P
At the top:
pawn Код:
new reactionstr[9]; //randomly generated string
new reactioninprog; //what status the reactiontest is at
new reactionwinnerid; //id of the current reactiontest winner
new reactiongap; //timer to restart ReactionTest()
pawn Код:
forward ReactionTest();
forward ReactionWin(playerid);
pawn Код:
#define time1 60000 //this is the 1 minute minimum gap time
#define time2 60000
pawn Код:
SetTimer("ReactionTest",time1+random(time2),1);
pawn Код:
public OnPlayerText(playerid, text[])
{
DisableWord("faggot",text);
DisableWord("fuck",text);
DisableWord("dick",text);
DisableWord("cunt",text);
DisableWord("penis",text);
if(!strcmp(text, reactionstr, false))
{
if(reactioninprog == 2) ReactionWin(playerid);
if(reactioninprog == 1)
{
if(reactionwinnerid == playerid)
{
SendClientMessage(playerid,0x247C1BFF,"You've already won!");
}
else
{
SendClientMessage(playerid,0x247C1BFF,"You are too slow!");
}
}
return 1;
}
return 1;
}
pawn Код:
if (strcmp("/test", cmdtext, true) == 0)
{
if(IsPlayerAdmin(playerid))
{
ReactionTest();
}
return 1;
}
pawn Код:
public ReactionTest()
{
reactionstr = "";
KillTimer(reactiongap);
new str[256];
new random_set[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // the set of characters used for the generation of the string
for (new i = 0; i < 8; i++)
{
reactionstr[i] = random_set[random(sizeof(random_set))];
}
reactioninprog = 2;
format(str,sizeof(str),"** First one to type %s wins $20000",reactionstr); // announcement
print(str);
SendClientMessageToAll(0xFFFF00FF,str);
}
public ReactionWin(playerid)
{
GivePlayerMoney(playerid, 20000);
SetTimer("SetBack",30,0); // required delay, for some reason.
new reactionwinner[256];
reactionwinnerid = playerid;
new tempstring[256];
GetPlayerName(playerid,reactionwinner,sizeof(reactionwinner));
format(tempstring,sizeof(tempstring),"%s has won $20000 on the Reaction Test",reactionwinner);
SendClientMessageToAll(0xFFFF00FF,tempstring);
reactiongap = SetTimer("ReactionTest",time1+random(time2),0); // sets the timer to restart ReactionTest()
}
Thnk you!
Here is the pastebin link...
http://pastebin.com/m5d81107a
P.S Peter, i put your name at the top because your the guy I know that can splve this... But if anyone lse wants a go, there is nothing stopping you :P