Math's Solver

Status
Not open for further replies.

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
* Name of the mod (if the mod doesn't exist, you don't have to tell one):
* Where you saw it (not the server, we mean if you saw any videos/screenshots about it or not): no where
* What do you want (the most important part, explain this carefully): Math's auto solver. Like "<< Answer 5+8+145 and get 1 Score and 1500$, /answer [ans] to type answer >>". I want this all to be done automatically. Solve and put the answer in chat.
* Details (add more details to your request): [size=x-small]I have played in many servers. They have solve the maths question for score and cash. It's really hard to calculate and answer. Before we answer them, someone else does it. So i want a plugin which might help everyone by doing this task automatically.[/size]
* On/off key (specify it): alt+1 or anything.
 

SafwanM

Active member
Joined
Mar 6, 2016
Messages
126
Reaction score
0
Location
Pakistan
i had a calculator cleo which makes it easier i got it from ugbase but i'll try to search it


EDIT:
Here you go http://ugbase.eu/Thread-Calculator
 

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
SafwanM said:
i had a calculator cleo which makes it easier i got it from ugbase but i'll try to search it


EDIT:
Here you go  http://ugbase.eu/Thread-Calculator



Thank you for this but the solver will be appreciated.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
158
"<< Answer 5+8+145 and get 1 Score and 1500$"
Is this the exact message? And is there always operations on 3 numbers? Or sometimes there are 2 or 4?
 

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
monday said:
"<< Answer 5+8+145 and get 1 Score and 1500$"
Is this the exact message? And is there always operations on 3 numbers? Or sometimes there are 2 or 4?

yeh. it is exactly the same but has random numbers and also there are addition subtraction, Multiplication like no.+no.-no. , no+no+no, no-no-no, no+no-no, no*no-no, no+no*no ....

The message has color like -- 

Line from chatlog

"{FFFFFF}[{FFBB88}»{FFFFFF}] Calculate '98+52-5' and type /ans <answer> [Prize: $12000 and 5 score]"

This ^. Please add time delay to it when answering. and activation key too
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
158
not tested but worth a try. To activate use command "/activate", there's a 3 seconds delay before posting the answer

Edit: it won't work if the answer is a float like 1.618, it requires sampfuncs
 

Attachments

  • math_solver.cs
    30.7 KB · Views: 71

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
monday said:
not tested but worth a try. To activate use command "/activate", there's a 3 seconds delay before posting the answer

Edit: it won't work if the answer is a float like 1.618, it requires sampfuncs

after typing /activate. it said no line found and at same time opcode errors started. Should talk line be on the place when we type /activate ?


it is like this

[18:55:50] {FFFFFF}[{FFBB88}»{FFFFFF}] Calculate '58*4-96' and type /ans <answer> [Prize: $13000 and 5 score]

[18:55:58] Warning(s007): Exception 0xC0000005 at 0x6EF3E40C

[18:55:58] Warning(s007): Exception 0xC0000005 at 0x6EF3E40C

[18:55:58] Warning(s007): Exception 0xC0000005 at 0x6EF3E40C
 

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
HarrisonFord said:
Just go to school. Learn Math = problem solved.

Well, I have learned math, but I'm lazy to calculate and answer them. Who love's math ?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
158
this code defeated me, I give up. It's a mess but worked for calculations on 3 numbers only. For some reason strings with maths operators get lost when passed to a function and I have no clue why, especially that the same mechanism works in the other mod (calculator). What's more peculiar, passing strings to a function appears to have an impact on the string even before this function is called.

It's a fiddly code but if anyone had an idea what could be wrong with it I'd appreciate

Part after reading the desired chat line:
Code:
0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@
0AF8: samp add_message_to_chat 25@ -1


Calculating part (working version)
Code:
                        if 0C29: 15@ = string1 31@ string2 "+"  
                        then
                        005B: 4@ += 2@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 31@ string2 "-"
                            then
                            0063: 4@ -= 2@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 31@ string2 "x"
                                0C29: 15@ = string1 31@ string2 "*"
                                then                  
                                006B: 4@ *= 2@  // (float)
                                else
                                    if 0C29: 15@ = string1 31@ string2 "/"
                                    then
                                    0073: 4@ /= 2@ // (float)
                                    end
                                end
                            end
                        end
                        
                        if 0C29: 15@ = string1 30@ string2 "+"  
                        then
                        005B: 4@ += 3@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 30@ string2 "-"
                            then
                            0063: 4@ -= 3@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 30@ string2 "x"
                                0C29: 15@ = string1 30@ string2 "*"
                                then                  
                                006B: 4@ *= 3@  // (float)
                                else
                                    if 0C29: 15@ = string1 30@ string2 "/"
                                    then
                                    0073: 4@ /= 3@ // (float)
                                    end
                                end
                            end
                        end


Calculating part, the same mechanism but passed to a function (not working version)
Code:
0AB1: @do_maths 3 num 4@ num2 2@ operator 31@ _returnedNum 4@
0AB1: @do_maths 3 num 4@ num2 3@ operator 30@ _returnedNum 4@ 

:do_maths
//0AF8: samp add_message_to_chat 2@ -1
if 0C29: 3@ = string1 2@ string2 "+"  
then
005B: 0@ += 1@  // (float)
else
    if 0C29: 3@ = strcmp string1 2@ string2 "-"
    then
    0063: 0@ -= 1@  // (float)
    else
        if or
        0C29: 3@ = string1 2@ string2 "x"
        0C29: 3@ = string1 2@ string2 "*"
        then                  
        006B: 0@ *= 1@  // (float)
        else
            if 0C29: 3@ = string1 2@ string2 "/"
            then
            0073: 0@ /= 1@ // (float)
            else
            0AF8: samp add_message_to_chat "Unrecognized uperator" -1
            0AF8: samp add_message_to_chat 2@ -1           
            end
        end
    end                    
end
0AB2: ret 1 0@


Using the function makes the previous part of the code display no parameter at all. I mean the following line:
[font=Monaco, Consolas, Courier, monospace]0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@ // 31@ seems to be empty[/font]


Edit: I uploaded wrong file but now it's replaced with the right one
 

Attachments

  • math_solver.cs
    34.5 KB · Views: 38

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
monday said:
this code defeated me, I give up. It's a mess but worked for calculations on 3 numbers only. For some reason strings with maths operators get lost when passed to a function and I have no clue why, especially that the same mechanism works in the other mod (calculator). What's more peculiar, passing strings to a function appears to have an impact on the string even before this function is called.

It's a fiddly code but if anyone had an idea what could be wrong with it I'd appreciate

Part after reading the desired chat line:
Code:
0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@
0AF8: samp add_message_to_chat 25@ -1


Calculating part (working version)
Code:
                        if 0C29: 15@ = string1 31@ string2 "+"  
                        then
                        005B: 4@ += 2@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 31@ string2 "-"
                            then
                            0063: 4@ -= 2@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 31@ string2 "x"
                                0C29: 15@ = string1 31@ string2 "*"
                                then                  
                                006B: 4@ *= 2@  // (float)
                                else
                                    if 0C29: 15@ = string1 31@ string2 "/"
                                    then
                                    0073: 4@ /= 2@ // (float)
                                    end
                                end
                            end
                        end
                        
                        if 0C29: 15@ = string1 30@ string2 "+"  
                        then
                        005B: 4@ += 3@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 30@ string2 "-"
                            then
                            0063: 4@ -= 3@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 30@ string2 "x"
                                0C29: 15@ = string1 30@ string2 "*"
                                then                  
                                006B: 4@ *= 3@  // (float)
                                else
                                    if 0C29: 15@ = string1 30@ string2 "/"
                                    then
                                    0073: 4@ /= 3@ // (float)
                                    end
                                end
                            end
                        end


Calculating part, the same mechanism but passed to a function (not working version)
Code:
0AB1: @do_maths 3 num 4@ num2 2@ operator 31@ _returnedNum 4@
0AB1: @do_maths 3 num 4@ num2 3@ operator 30@ _returnedNum 4@ 

:do_maths
//0AF8: samp add_message_to_chat 2@ -1
if 0C29: 3@ = string1 2@ string2 "+"  
then
005B: 0@ += 1@  // (float)
else
    if 0C29: 3@ = strcmp string1 2@ string2 "-"
    then
    0063: 0@ -= 1@  // (float)
    else
        if or
        0C29: 3@ = string1 2@ string2 "x"
        0C29: 3@ = string1 2@ string2 "*"
        then                  
        006B: 0@ *= 1@  // (float)
        else
            if 0C29: 3@ = string1 2@ string2 "/"
            then
            0073: 0@ /= 1@ // (float)
            else
            0AF8: samp add_message_to_chat "Unrecognized uperator" -1
            0AF8: samp add_message_to_chat 2@ -1           
            end
        end
    end                    
end
0AB2: ret 1 0@


Using the function makes the previous part of the code display no parameter at all. I mean the following line:
[font=Monaco, Consolas, Courier, monospace]0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@ // 31@ seems to be empty[/font]

Thank you bro. Ill try this out :)
 

Commander

Active member
Joined
Jan 23, 2014
Messages
49
Reaction score
0
monday said:
this code defeated me, I give up. It's a mess but worked for calculations on 3 numbers only. For some reason strings with maths operators get lost when passed to a function and I have no clue why, especially that the same mechanism works in the other mod (calculator). What's more peculiar, passing strings to a function appears to have an impact on the string even before this function is called.

It's a fiddly code but if anyone had an idea what could be wrong with it I'd appreciate

Part after reading the desired chat line:
Code:
0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@
0AF8: samp add_message_to_chat 25@ -1


Calculating part (working version)
Code:
                        if 0C29: 15@ = string1 31@ string2 "+"  
                        then
                        005B: 4@ += 2@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 31@ string2 "-"
                            then
                            0063: 4@ -= 2@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 31@ string2 "x"
                                0C29: 15@ = string1 31@ string2 "*"
                                then                  
                                006B: 4@ *= 2@  // (float)
                                else
                                    if 0C29: 15@ = string1 31@ string2 "/"
                                    then
                                    0073: 4@ /= 2@ // (float)
                                    end
                                end
                            end
                        end
                        
                        if 0C29: 15@ = string1 30@ string2 "+"  
                        then
                        005B: 4@ += 3@  // (float)
                        else
                            if 0C29: 15@ = strcmp string1 30@ string2 "-"
                            then
                            0063: 4@ -= 3@  // (float)
                            else
                                if or
                                0C29: 15@ = string1 30@ string2 "x"
                                0C29: 15@ = string1 30@ string2 "*"
                                then                  
                                006B: 4@ *= 3@  // (float)
                                else
                                    if 0C29: 15@ = string1 30@ string2 "/"
                                    then
                                    0073: 4@ /= 3@ // (float)
                                    end
                                end
                            end
                        end


Calculating part, the same mechanism but passed to a function (not working version)
Code:
0AB1: @do_maths 3 num 4@ num2 2@ operator 31@ _returnedNum 4@
0AB1: @do_maths 3 num 4@ num2 3@ operator 30@ _returnedNum 4@ 

:do_maths
//0AF8: samp add_message_to_chat 2@ -1
if 0C29: 3@ = string1 2@ string2 "+"  
then
005B: 0@ += 1@  // (float)
else
    if 0C29: 3@ = strcmp string1 2@ string2 "-"
    then
    0063: 0@ -= 1@  // (float)
    else
        if or
        0C29: 3@ = string1 2@ string2 "x"
        0C29: 3@ = string1 2@ string2 "*"
        then                  
        006B: 0@ *= 1@  // (float)
        else
            if 0C29: 3@ = string1 2@ string2 "/"
            then
            0073: 0@ /= 1@ // (float)
            else
            0AF8: samp add_message_to_chat "Unrecognized uperator" -1
            0AF8: samp add_message_to_chat 2@ -1           
            end
        end
    end                    
end
0AB2: ret 1 0@


Using the function makes the previous part of the code display no parameter at all. I mean the following line:
[font=Monaco, Consolas, Courier, monospace]0AD3: 25@ = format "Formula detected: %.0f %s %.0f %s %.0f" 1@ 31@ 5@ 30@ 3@ // 31@ seems to be empty[/font]

Well the server will always give 3 numbers. This cleo plugin show's /activate but when the quiz appear's. It doesnt answer :/
I still need someone to do it  :sadpepe:
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
158
fuck my life, I uploaded wrong file, sorry. This is the right one

Vi6oYxP.png
 

Attachments

  • math_solver.cs
    34.5 KB · Views: 72
Status
Not open for further replies.
Top