Вопросы по CLEO-скриптингу

Dark_Knight

Me, me and me.
Друг
4,064
2,078
если вам отвечают не готовым решением, это значит, что на создание, отладку и тестирование такого скрипта возможно придется потратить достаточно много полезного времени, в большинстве же здесь в качестве готовых решений либо поправки к уже написанному скрипту, либо скрипты которые можно написать за пару минут. Да и тема вопросов, в не сделайте скрипт.
Чтобы сделать плавный переворот нужно просто в цикле с wait каким-то плюсовать один из углов поворота.
я сейчас просто зашел в SB и ввел в поиск опкодов: "car rot" тут же мне выдает
07DA: set_car 46@ rotation_velocity_XYZ 0.0 -0.35 0.2 through_center_of_body
07DB: set_car 189@ rotation_velocity_XYZ 3.5 7.3999 8.1003 through_center_of_mass
думаю один из них будет идеальным решением, установить скорость плавную, пока машина не встанет в допустимое положение

Можно ебануть без воита, но с маленьким шахом переворота. Отличным вариантом будет for
 

hnnssy

Известный
Друг
2,684
2,748
Можно ебануть без воита, но с маленьким шахом переворота. Отличным вариантом будет for
Вот я делал для разворота авто на 360 градусов.
PHP:
if and
Actor.Driving($PLAYER_ACTOR)
0AB0:   key_pressed 1
then    
03C0: 0@ = actor $PLAYER_ACTOR car
0174: 1@ = car 0@ Z_angle
2@ = 1@
2@ += 360.0
    for 3@ = 1@ to 2@ step 10.0
    wait 0
        if Actor.Driving($PLAYER_ACTOR)
        then
        0175: set_car 0@ Z_angle_to 3@
        end
    end
end
 

SR_team

like pancake
BH Team
4,720
6,370
Вот я делал для разворота авто на 360 градусов.
PHP:
if and
Actor.Driving($PLAYER_ACTOR)
0AB0:  key_pressed 1
then   
03C0: 0@ = actor $PLAYER_ACTOR car
0174: 1@ = car 0@ Z_angle
2@ = 1@
2@ += 360.0
    for 3@ = 1@ to 2@ step 10.0
    wait 0
        if Actor.Driving($PLAYER_ACTOR)
        then
        0175: set_car 0@ Z_angle_to 3@
        end
    end
end

Это Z, а ему Y нужен. Y вроде у перевернутой машины не определяется. Так что нужно проверить отдельно перевернута ли машина и перевернуть ее 1 из представленных альфой опкодов
 

hnnssy

Известный
Друг
2,684
2,748
Это Z, а ему Y нужен. Y вроде у перевернутой машины не определяется. Так что нужно проверить отдельно перевернута ли машина и перевернуть ее 1 из представленных альфой опкодов
Я в качестве примера скинул.
 

TheMonstercat

Известный
75
11
Hey i need this for 0.3z

Код:
:getText
{
    Example: 0AB1: call @getText 2 0@ 28@ return: 27@
    In: 0@ - SAMP BASE; 1@ - TextDraw ID;
    Out: 4@ - text
}
    0085: 2@ = 0@
    2@ += 2173496
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 979
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ -= 9224
    3@ = 4
    006A: 3@ *= 1@
    005A: 2@ += 3@
    0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0
0AB2: ret 1 4@
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,459
Hey i need this for 0.3z[/CODE]

Код:
:getText
{
    Example: 0AB1: call @getText 2 0@ 28@ return: 27@
    In: 0@ - SAMP BASE; 1@ - TextDraw ID;
    Out: 3@ - text
}
    0085: 2@ = 0@
    2@ += 0x212A80
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x3D9
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x2400
 
    1@ *= 4
    005A: 2@ += 1@
    0A8D: 3@ = read_memory 2@ size 4 virtual_protect 0
0AB2: ret 1 3@
 

АндрейЧотак

Известный
80
10
Почему авто-логин не работает?
Код:
{$CLEO}
 
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
        wait 100
end
 
0B34: samp register_client_command "autorec" to_label @rec1
0B34: samp register_client_command "autorec_off" to_label @rec2
 
alloc 8@ 256
if
8AE4:  not directory_exists "Cleo\INI"
then
0AE5: create_directory "Cleo\INI"
end
if
0AAB:  file_exists "CLEO\INI\Autoreconnect.ini"
then
0AF4: 8@ = read_string_from_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
else
0AF5: write_string "text" to_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
end
 
while true
wait 0
if 12@ == 1
then
    0ac8: 0@ = 64
    0ac8: 2@ = 256
    0ac8: 3@ = 0
    0B75: samp get_chat_string 99 text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
wait 0
if 0C18: 0@ strstr string1 2@ string2 "Server closed the connection."
then
0B28: samp disconnect_with_reason 0
wait 50
0B27: samp set_gamestate 4
wait 6@
0B27: samp set_gamestate 1
wait 2000
if
SAMP.IsDialogActive(1)
then
0AF4: 2@v = read_string_from_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
SAMP.SetDialogInputBoxText(2@v)
wait 100
SAMP.CloseDialog(1)
    0ac9: 0@
    0ac9: 2@
    0ac9: 3@
end
end
end
end
 
:rec1
12@ = true
0B35: samp 1@ = get_last_command_params
if 0AD4: 7@ = scan_string 1@ format "%d" 6@
then
if 6@ >= 0
then
0AF8: samp add_message_to_chat "Auto Reconnect on" color 0x00CC00
0AF8: samp add_message_to_chat "Time: %d" color 0x99CC00 6@
end
end
SAMP.CmdRet()
 
:rec2
12@ = false
0AF8: samp add_message_to_chat "Auto Reconnect off" color 0xFF0000
SAMP.CmdRet()
 

alfazlo

Потрачен
128
36
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Почему авто-логин не работает?
Код:
{$CLEO}
 
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
        wait 100
end
 
0B34: samp register_client_command "autorec" to_label @rec1
0B34: samp register_client_command "autorec_off" to_label @rec2
 
alloc 8@ 256
if
8AE4:  not directory_exists "Cleo\INI"
then
0AE5: create_directory "Cleo\INI"
end
if
0AAB:  file_exists "CLEO\INI\Autoreconnect.ini"
then
0AF4: 8@ = read_string_from_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
else
0AF5: write_string "text" to_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
end
 
while true
wait 0
if 12@ == 1
then
    0ac8: 0@ = 64
    0ac8: 2@ = 256
    0ac8: 3@ = 0
    0B75: samp get_chat_string 99 text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
wait 0
if 0C18: 0@ strstr string1 2@ string2 "Server closed the connection."
then
0B28: samp disconnect_with_reason 0
wait 50
0B27: samp set_gamestate 4
wait 6@
0B27: samp set_gamestate 1
wait 2000
if
SAMP.IsDialogActive(1)
then
0AF4: 2@v = read_string_from_ini_file "CLEO\INI\Autoreconnect.ini" section "AUTOLOGIN" key "Pass"
SAMP.SetDialogInputBoxText(2@v)
wait 100
SAMP.CloseDialog(1)
    0ac9: 0@
    0ac9: 2@
    0ac9: 3@
end
end
end
end
 
:rec1
12@ = true
0B35: samp 1@ = get_last_command_params
if 0AD4: 7@ = scan_string 1@ format "%d" 6@
then
if 6@ >= 0
then
0AF8: samp add_message_to_chat "Auto Reconnect on" color 0x00CC00
0AF8: samp add_message_to_chat "Time: %d" color 0x99CC00 6@
end
end
SAMP.CmdRet()
 
:rec2
12@ = false
0AF8: samp add_message_to_chat "Auto Reconnect off" color 0xFF0000
SAMP.CmdRet()

я конечно не эксперт в cleo, но не проще проверять статус подключения к серверу после входа?
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,459
Как отправить клиенту команду /fpslimit 45 ? 0AF9: samp say_msg "/fpslimit 45" не выходит

Код:
:SAMP_SetFpsLimit
1@ = SAMP.Base()
0A8E: 2@ = 1@ + 0x64280
0C0C: 1@ = struct 1@ offset 0x212A94 size 4
0AA6: call_method 2@ struct 1@ num_params 1 pop 0 0@
0ab2: ret 0

Используешь так: 0ab1: call @SAMP_SetFpsLimit 1 fps 45
 

Opcode.eXe

Известный
84
112
Hey,
is there an opcode to check if button is pressed for sampfuncs dialogs?

0B82: dialog 1@ add_button id 0 text "OK" pos_XY 0 0 size 40 40

I know there is 0B92: dialog 1@ checkbox 0 is_checked, but nothing for buttons?
 

hnnssy

Известный
Друг
2,684
2,748
Hey,
is there an opcode to check if button is pressed for sampfuncs dialogs?

0B82: dialog 1@ add_button id 0 text "OK" pos_XY 0 0 size 40 40

I know there is 0B92: dialog 1@ checkbox 0 is_checked, but nothing for buttons?
Use this:
PHP:
while true
wait 0
0B81: dialog 1@ pop_event_to 2@ control_id_to 3@
//1@ - your dialog, 2@ - event, 3@ - id of element
if and
3@ == 3 // ID
2@ == 257 // pressed
then
//code
end
end
 
  • Нравится
Реакции: alfazlo

alfazlo

Потрачен
128
36
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Use this:
PHP:
while true
wait 0
0B81: dialog 1@ pop_event_to 2@ control_id_to 3@
//1@ - your dialog, 2@ - event, 3@ - id of element
if and
3@ == 3 // ID
2@ == 257 // pressed
then
//code
end
end

один недостаток.
0B81: dialog 1@ pop_event_to 2@ control_id_to 3@ // IF AND SET опкод лучше пихать в проверку, а то возможно одно и тоже событие будет срабатывать бесконечно, или там обнуляется событие и кнопка
?