Tak sobie znalaz?em kalkulator cleo, niestety nie dzia?a on do ko?ca tak, jak nale?y, wi?c wystawiam sam kod i jak kto? chce, to niech naprawi i korzysta
Aby u?y? kalkulatora, nale?y w okienku chatu wpisa? "/cc [dzia?anie]" np. "/cc 2+2".
Rozwi?zanie pojawia si? na g?rze ekranu.
Kalkulator dodaje, odejmuje, mno?y i dzieli. (+, -, x, /)
C?? jest w nim zepsutego? Wykonuje zazwyczaj p?? podanego dzia?ania, ?le odejmuje, nie ogarnia liczb ujemnych i chyba nie potrafi dzieli? x=D, wi?c mo?ecie t? wstawk? potraktowa? jako snippeta. heh.
Ma potencja?, widz? nawet mo?liwo?? wykorzystania przy eventach na ekranie typu "podaj rozwi?zanie dzia?ania".
Szkoda, ?e zbugowane. Mo?e kto? kto ogarnia CLEO we?mie si? za to? W og?le z jakiego powodu obliczenia nie s? poprawne? Kto? ?le to napisa? czy po prostu CLEO nie obs?uguje dzia?a? matematycznych?
Mo?na z tego skorzysta?, kiedy trzeba co? policzy? na szybko, a nie chce si? odpala? windowsowego calc.exe lub bra? telefonu do r?ki, ale masz racj?. Na wielu serwerach co jaki? czas pojawia si? dzia?anie na dole ekranu.
Kto? ?le to napisa?. Skrypt jest niedopracowany, a ja w sumie... m?g?bym si? za niego zabra?, ale nie mam zbytnio pomys?u i czasu
Sory ale pomy?ka da si? jeszcze ?atwiej format(wynik, sizeof(wynik), "Wynik to %i", params); System sam ci podzieli i reszta bo poka?e ci params czyli jak wpiszesz 2+2 to si? wpisze w formacie i si? obliczy samo ps. Dzia?a sprawdzalem zr?b to w dcmd lub zcmd najlepiej potem podam ca?y kod bo jestem na telku
Czesc, to ja napisalem ten kod, milo ze ktos go uzywa
Faktycznie mod nie ogarnia liczb ujemnych aczkolwiek niezdarzylo mi sie aby podal bledny wynik odejmowania, dzielenia lub zeby przekalkulowal "pol podanego dzialania", pamietajac ze mod robi kalkulacje na maksymalnie 4 liczbach jak bylo oswiadczone w temacie w ktorym ten mod pierwotnie sie pojawil:
http://ugbase.eu/Thread-Calculator
[ Dodano: 2017-06-08, 03:33 ]
Jesli ktos jest zainteresowany to dzisiaj opublikowalem kod ktory automatycznie rozwiazuje zadania matematyczne, szczerze mowiac to nie pamietam na jakim serwerze go testowalem ale dzialal bez zarzutu
while true
wait 0
if and
27@ == 1
24@ == 1
then
24@ = 0
//0AB1: @GETCHATENTRYTEXT 1 id 99 to 0@
samp.GetChatString(99, 16@, 0, 0, 0)
//0AF8: samp add_message_to_chat 0@ color -1
//
//4 numbers
//
if or
//0AD4: $nefolosit = 0@ format "%d%c%d%c%d%c%d" 1@ 31@ 2@ 30@ 3@ 29@ 4@
0AD4: 12@ = 16@ format "{FFFFFF}[{FFBB88}»{FFFFFF}] Calculate '%d%c%d%c%d%c%d' and type /ans <answer> [Prize: $%d and %d score]" 1@ 31@ 2@ 30@ 3@ 29@ 4@ 9@ 10@
0AD4: 12@ = 16@ format "{FFFFFF}[{FFBB00}»{FFFFFF}] Calculate '%d%c%d%c%d%c%d' and type /ans <answer> [Prize: $%d and %d score]" 1@ 31@ 2@ 30@ 3@ 29@ 4@ 9@ 10@
then
0AD3: 31@ = format "%c" 31@
0AD3: 30@ = format "%c" 30@
0AD3: 29@ = format "%c" 29@
0085: 5@ = 1@ // result
0085: 6@ = 2@ // num2
0085: 7@ = 3@ // num3
0093: 1@ = integer 1@ to_float
0093: 2@ = integer 2@ to_float
0093: 3@ = integer 3@ to_float
0093: 4@ = integer 4@ to_float
0093: 5@ = integer 5@ to_float
0093: 6@ = integer 6@ to_float
0093: 7@ = integer 7@ to_float
if 0AB1: @p_3 3 31@ 30@ 29@
then
0AB1: @do_maths 3 num 5@ num2 2@ operator 31@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 3@ operator 30@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 4@ operator 29@ _returnedNum 5@
else
if 0AB1: @n_2 2 30@ 29@
then
0AB1: @do_maths 3 num 5@ num2 2@ operator 31@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 3@ operator 30@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 4@ operator 29@ _returnedNum 5@
else
if 0AB1: @p_n 2 30@ 29@
then
0AB1: @do_maths 3 num 2@ num2 3@ operator 30@ _returnedNum 2@
0AB1: @do_maths 3 num 5@ num2 2@ operator 31@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 4@ operator 29@ _returnedNum 5@
else
if 0AB1: @p_n 2 29@ 30@
then
0AB1: @do_maths 3 num 3@ num2 4@ operator 29@ _returnedNum 3@
0AB1: @do_maths 3 num 5@ num2 2@ operator 31@ _returnedNum 5@
0AB1: @do_maths 3 num 5@ num2 3@ operator 30@ _returnedNum 5@
else
if 0AB1: @p_2 2 30@ 29@
then
0AB1: @do_maths 3 num 2@ num2 3@ operator 30@ _returnedNum 2@
0AB1: @do_maths 3 num 2@ num2 4@ operator 29@ _returnedNum 2@
0AB1: @do_maths 3 num 5@ num2 2@ operator 31@ _returnedNum 5@
else
0AF8: samp add_message_to_chat "Error: Unknown order of operations (the script is incorrect)" color -1
end
end
end
end
end
0092: 4@ = float 4@ to_integer
0AD3: 22@ = format "/ans %d" 4@
wait 11@
0AF9: samp say_msg 22@
//0AF8: samp add_message_to_chat 22@ -1
else
//
//2 numbers
//
if or
0AD4: 12@ = 16@ format "{FFFFFF}[{FFBB88}»{FFFFFF}] Calculate '%d%c%d' and type /ans <answer> [Prize: $%d and %d score]" 1@ 31@ 2@ 9@ 10@
0AD4: 12@ = 16@ format "{FFFFFF}[{FFBB00}»{FFFFFF}] Calculate '%d%c%d' and type /ans <answer> [Prize: $%d and %d score]" 1@ 31@ 2@ 9@ 10@
then
0AD3: 31@ = format "%c" 31@
0085: 4@ = 1@ // result
0093: 1@ = integer 1@ to_float
0093: 2@ = integer 2@ to_float
0093: 4@ = integer 4@ to_float
0AB1: @do_maths 3 num 4@ num2 2@ operator 31@ _returnedNum 4@
0AD3: 25@ = format "%.0f %s %.0f" 1@ 31@ 2@
//if 0AB1: @decimal_check_result 1 4@
//then
//0AD3: 26@ = format "%0.4f" 4@
//else
//0AD3: 26@ = format "%.0f" 4@
//end
0092: 4@ = float 4@ to_integer
0AD3: 22@ = format "/ans %d" 4@
//wait 11@
0AF9: samp say_msg 22@
else
// printf "Expected chatline is not the same as the servers' one" 5000
end
end
end
end
end
:activate
0B12: 27@ = 27@ XOR 1
if 27@ == 1
then
0AD1: show_formatted_text_highpriority "activated" time 700
else
0AD1: show_formatted_text_highpriority "deactivated" time 700
end
samp.CmdRet
:on_new_chatline
0BE5: raknet 23@ = get_hook_param PARAM_PACKETID
if 23@ == RPC_ScrClientMessage
then
24@ = 1
end
0BE0: raknet hook_ret true
31@ = 0
if or
0C29: 15@ = string1 0@ string2 "x"
0C29: 16@ = string1 0@ string2 "*"
0C29: 17@ = string1 0@ string2 "/"
then
31@++
end
if or
0C29: 16@ = string1 1@ string2 "x"
0C29: 17@ = string1 1@ string2 "*"
0C29: 15@ = string1 1@ string2 "/"
then
31@++
end
if 31@ == 2
then
0485: return_true
else
059A: return_false
end
0AB2: ret 0
:n_2
31@ = 0
if or
0C29: 15@ = string1 0@ string2 "x"
0C29: 16@ = string1 0@ string2 "*"
0C29: 17@ = string1 0@ string2 "/"
then
31@++
end
if or
0C29: 15@ = string1 1@ string2 "x"
0C29: 16@ = string1 1@ string2 "*"
0C29: 17@ = string1 1@ string2 "/"
then
31@++
end
if 31@ > 0
then
059A: return_false
else
0485: return_true
end
0AB2: ret 0
:p_n
31@ = 0
if or
0C29: 15@ = string1 0@ string2 "x"
0C29: 16@ = string1 0@ string2 "*"
0C29: 17@ = string1 0@ string2 "/"
then
31@++
end
if or
0C29: 15@ = string1 1@ string2 "x"
0C29: 16@ = string1 1@ string2 "*"
0C29: 17@ = string1 1@ string2 "/"
then
wait 0
else
31@++
end
if 31@ == 2
then
0485: return_true
else
059A: return_false
end
0AB2: ret 0
//if 0AB1: @is_priority 1
:priority
if or
0C29: 15@ = string1 0@ string2 "x"
0C29: 16@ = string1 0@ string2 "*"
0C29: 17@ = string1 0@ string2 "/"
then
0485: return_true
else
059A: return_false
end
0AB2: ret 0
//if 0AB1: @not_priority 1
:no_priority
if or
0C29: 15@ = string1 0@ string2 "x"
0C29: 16@ = string1 0@ string2 "*"
0C29: 17@ = string1 0@ string2 "/"
then
059A: return_false
else
0485: return_true
end
0AB2: ret 0
//if 0AB1: @decimal_check_result 1
:decimal_check_result
0092: 1@ = float 0@ to_integer
0093: 1@ = integer 1@ to_float
if or
0025: 1@ > 0@ // (float)
0025: 0@ > 1@ // (float)
then
0485: return_true
else
059A: return_false
end
0AB2: ret 0
Linie warte edytowania:
-te zaczynajace sie na: 0AD4: 12@ = 16@ format "{FFFFFF}[{FFBB88}»{FFFFFF}] Calculate
-te zaczynajace sie na: 0AD3: 22@ = format "/ans %d"
-komenda aktywujaca: 0B34: samp register_client_command "activate" to_label @activate
Mod byl testowany z:
-Cleo 4.1 (z 4.3 prawdopodobnie nie bedzie dzialac)
-Samp Functions 5.1 (z najnowszym tez powinien dzialac)
-SA-MP 0.3z R1 (z 0.3.7 tez powinien dzialac)
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach