Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new isnow;
- new result;
- new string_script[100];
- new numb[4];
- #define TIME 5
- #define RANDOMM 6
- new playername_script[MAX_PLAYERS][MAX_PLAYER_NAME+1];
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, playername_script[playerid], MAX_PLAYER_NAME+1);
- return 1;
- }
- public OnFilterScriptInit() {
- SetTimer("math", 1000 * 60 * TIME, true);
- return 1;
- }
- forward math();
- public math() {
- if(!isnow)
- {
- switch(random(RANDOMM))
- {
- case 0: {
- result = (numb[0]=random(1000)) + (numb[1]=random(840));
- format(string_script, sizeof(string_script),"A new mathematical puzzle {00AAFF}%d{FFFFFF} + {00AAFF}%d{FFFFFF} Send the result to chat",numb[0], numb[1]);
- }
- case 1: {
- do
- {
- result = (numb[0]=random(500)) - (numb[1]=random(500));
- } while(numb[0] < numb[1]);
- format(string_script, sizeof(string_script),"A new mathematical puzzle {00AAFF}%d{FFFFFF} - {00AAFF}%d{FFFFFF} Send the result to chat",numb[0], numb[1]);
- }
- case 2: {
- result = (numb[0]=random(100)) * (numb[1]=random(80));
- format(string_script, sizeof(string_script),"A new mathematical puzzle %d*%d - Send the result to chat",numb[0], numb[1]);
- }
- case 3: {
- do {
- result = (numb[0]=random(1000)+1) / (numb[1]=random(600)+1);
- } while(numb[0] % numb[1]);
- format(string_script, sizeof(string_script),"A new mathematical puzzle {00AAFF}%d{FFFFFF} / {00AAFF}%d{FFFFFF} Send the result to chat",numb[0], numb[1]);
- }
- case 4: {
- result = (numb[0]=random(10)+1) * numb[0];
- format(string_script, sizeof(string_script),"A new mathematical puzzle kwadrat liczby {00AAFF}%d{FFFFFF} Send the result to chat",numb[0]);
- }
- case 5: {
- result = (numb[0]=random(10)+1) * numb[0] * numb[0];
- format(string_script, sizeof(string_script),"A new mathematical puzzle sześcian liczby {00AAFF}%d{FFFFFF} Send the result to chat",numb[0]);
- }
- }
- SendClientMessageToAll(-1, string_script);
- isnow = true;
- }
- else {
- isnow = false;
- format(string_script, sizeof(string_script),"No one guessed the riddle of mathematical");
- SendClientMessageToAll(-1, string_script);
- }
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(isnow && text[0] && result == strval(text))
- {
- isnow = false;
- format(string_script, sizeof(string_script),"%s Won math riddle!",playername_script);
- SendClientMessageToAll(-1, string_script);
- Prize(playerid);
- return 0;
- }
- return 1;
- }
- stock Prize(playerid)
- {
- GivePlayerMoney(playerid, 444444);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement