SA-MP Forums Archive
[FilterScript] Maths Riddle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Maths Riddle (/showthread.php?tid=443781)



Maths Riddle - G0rniczek - 13.06.2013

Maths Riddle v3.0

What is Maths Riddle script?
Maths Riddle it's a simple my script for you server for attraction. Players can guess the result of mathematical operations like:
45 + 25,45 - 25,45 / 5,45 * 25.
Just install and your players can get some award* for current result! You only must configure how often riddle start! (in minutes)

Maths Riddle - operations
adding,
subtraction,
multiplication,
division

All this operations it's tested and all works! Never happen to share a number which can not be divided, subtract the smaller number from the larger.

Maths Riddle - commands, award
Only one command for admin:
/riddle - start the math riddle without wait time
How to add award? In OnPlayerText callback after this:
Код:
format(str, sizeof(str),"{00AAFF}%s{FFFFFF} guessed the riddle of mathematical. (result: {00AAFF}%d{FFFFFF})",name,result);
SendClientMessageToAll(-1, str);
example:
Код:
format(str, sizeof(str),"{00AAFF}%s{FFFFFF} guessed the riddle of mathematical. (result: {00AAFF}%d{FFFFFF})",name,result);
SendClientMessageToAll(-1, str);
GivePlayerMoney(playerid, 10000);
Maths Riddle - How to configure, and add new operations?
Код:
#define TIME 5 // edit this line to set how often riddle start! (in minutes)
#define RAND 4 // number of mathematical operations (LOOK in line: 28)
How to add new operation?

You must change (#define RAND) and after there:

Код:
case 3: {
do
{
result = (numbers[0]=random(1000)+1) / (numbers[1]=random(600)+1);
} while(numbers[0] % numbers[1]);
format(str, sizeof(str),"New maths riddle is: {00AAFF}%d{FFFFFF} / {00AAFF}%d{FFFFFF} = ?",numbers[0], numbers[1]);
SendClientMessageToAll(-1, str);
isnow = true;
}
add operation with this model:
Код:
case 4: { // 4 is the next operation
result = (numbers[0]=random(1000)) + (numbers[1]=random(840)); // change this example: result = (numbers[0]=random(30)) * (numbers[1]=random(10) + (numbers[2]=random(30));
format(str, sizeof(str),"New maths riddle is: {00AAFF}%d{FFFFFF} * {00AAFF}%d{FFFFFF} + {00AAFF}%d{FFFFFF} = ?",numbers[0], numbers[1], numbers[2]); 
SendClientMessageToAll(-1, str); // no change
isnow = true; // no change
}
Maths Riddle - credits
Programming:
Gorniczek (www.truck-spd.pl) for this script

Maths Riddle - download
http://www.solidfiles.com/d/bcd3dbfae9/


Re: Maths Riddle - [UG]Daniel - 13.06.2013

Nice and simple


Re: Maths Riddle - G0rniczek - 14.06.2013

I fixed most of the errors.


Re: Maths Riddle - dEcooR - 14.06.2013

Good work dude


Re: Maths Riddle - G0rniczek - 15.06.2013

Thanks.


Re: Maths Riddle - Avi57 - 15.06.2013

Nice.
Repped +.


Re: Maths Riddle - G0rniczek - 15.06.2013

Can anyone have any ideas for new activities?


Re: Maths Riddle - gogokickup - 16.06.2013

Usefull


Re: Maths Riddle - G0rniczek - 21.06.2013

New version, added:
* involution:
- square,
- cube
* root


Link: http://www.solidfiles.com/d/bcd3dbfae9/ (and in first post)


Re: Maths Riddle - iHaze. - 22.06.2013

Awesome :O