06.05.2013, 11:49
(
Последний раз редактировалось brawrr; 06.10.2013 в 17:59.
)
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!
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;
}