Question Calculator Game -
brawrr - 06.05.2013
Now all players can write answer on Calculator questions and win for this some money or another thing!
If you like it, give me rep+! thx
Download!
PHP код:
#define FILTERSCRIPT
#include <a_samp>
#define questiontime 2//2 its time in minutes when players see another question, you can change it!
forward AnswerSysTimer();
new PravelniyOtvet = 0;
public OnFilterScriptInit()
{
new time = questiontime*60000;
print("Question Sys By brawrr / Skype Rev1se");
SetTimer("AnswerSysTimer", time, 1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[80],cmd[256],tmp[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/ans", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PravelniyOtvet == 0)
{
SendClientMessage(playerid, 0xFF6347AA, "There are no questions!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF6347AA, "Help: /ans [answer]");
return 1;
}
new otvet;
otvet = strval(tmp);
if(otvet < -9999 || otvet > 9999)
{
SendClientMessage(playerid, 0xFF6347AA, "Answer can by -9999 - 9999!");
return 1;
}
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername,MAX_PLAYER_NAME);
if(otvet == PravelniyOtvet)
{
//GivePlayerMoney(playerid, 10000); Uncomment if you wont give to player some money for right answer
format(string, sizeof(string), "[Question] %s answered: %d, That's right!",playername,otvet);
SendClientMessageToAll(0x1CBC46AA, string);
PravelniyOtvet = 0;
}
else
{
format(string, sizeof(string), "[Question] %s answered: %d, Wrong answer!",playername,otvet);
SendClientMessageToAll(0xFF6347AA, string);
}
}
return 1;
}
return 1;
}
public AnswerSysTimer()
{
new string[60];
new rand1 = random(999)+1;
new rand2 = random(999)+1;
new rand3 = random(999)+1;
PravelniyOtvet = rand1+rand2-rand3;
format(string, sizeof(string), "[Question] %d+%d-%d? Write answer /ans",rand1,rand2,rand3);
SendClientMessageToAll(0xFF6347AA, string);
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: Question Calculator Game -
James Coral - 06.05.2013
seems nice

+REP keep it up
Re: Question Calculator Game -
ahmad95 - 06.05.2013
Nice!
Re: Question Calculator Game -
Xport6050 - 06.05.2013
nice need some shots
Re: Question Calculator Game -
Mark_Samp - 06.05.2013
Very good work dude , I like your idea

I love it

+REP
Re: Question Calculator Game -
brawrr - 08.05.2013
Xport6050 what shots? i can update script, if need some thing...
Re: Question Calculator Game -
SampN - 08.05.2013
Nice
Re: Question Calculator Game -
brawrr - 14.05.2013
thx, any sugestions for update this script?
Re: Question Calculator Game -
SilentSoul - 07.09.2013
Awesome! , +1 rep
Re: Question Calculator Game -
brawrr - 06.10.2013
download link is updated!