30.08.2012, 15:32
Use this code
pawn Код:
#include <a_samp>
#define COLOR_GREEN 0x00A800AA
new MinQuestionScore = 1;
new MaxQuestionScore = 7;
new RandomQuestionScore;
new QuestionStarted;
new Question[32];
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
forward SendQuestionForScore();
public OnFilterScriptInit()
{
SetTimer("SendQuestionForScore", 240000, true);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public SendQuestionForScore()
{
new string[128];
new qstring[32];
RandomQuestionScore = MinQuestionScore+random(MaxQuestionScore-MinQuestionScore);
format(qstring, sizeof(qstring), "%d%d%d%d%d%d%d%d", random(9), random(9), random(9), random(9), random(9), random(9), random(9), random(9));
strmid(Question, qstring, false, strlen(qstring), 32);
format(string, sizeof(string), "** Question: Are you still alive? **: The fastest who types %s will earn $%d,-!", qstring, RandomQuestionMoney);
SendClientMessageToAll(COLOR_GREEN, string);
QuestionStarted = 1;
return 1;
}
public OnPlayerText(playerid, text[])
{
if(QuestionStarted == 1 && strfind(text[0], Question, false) == 0)
{
new string[128];
format(string, sizeof(string), "$$$ %s has won $%d,- by typing '%s' the fastest! $$$", PlayerName[playerid], RandomQuestionMoney, Question);
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerScore(playerid, GetPlayerScore(playerid) + RandomQuestionScore);
QuestionStarted = 0;
return 0;
}
return 1;
}