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

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,967
CLEO:
{$CLEO}
0000:

:SAMPAv
wait 0
0AFA:  is_samp_available
jf @SAMPAv
0B80: dialog 0@ = create "MENU"
0B86: dialog 0@ set_visible 0
0B84: dialog 0@ set_pos_XY 500 500 size 300 225
0B82: dialog 0@ add_button id 1 text "0 hp" pos_XY 0 0 size 100 30
0B82: dialog 0@ add_button id 2 text "45 hp" pos_XY 0 25 size 100 30
0B82: dialog 0@ add_button id 3 text "100 hp" pos_XY 0 50 size 100 30
0B82: dialog 0@ add_button id 4 text "Text" pos_XY 0 75 size 100 30

:OnDialog
wait 0
0ADC:   test_cheat "ON"
jf @OnDialog
0B86: dialog 0@ set_visible 1
0B8D: samp set_cursor_mode 2

// Тут код после включения диалога.

:OffDialog
wait 0
0ADC:   test_cheat "OFF"
jf @OffDialog
0B86: dialog 0@ set_visible 0
0B8D: samp set_cursor_mode 0
jump @OnDialog
 
  • Нравится
Реакции: zwhoz

Vadim.dll

Известный
168
80
Itz подскажи пожалуйста есть 2 случая

1:
не понимаю что здесь не так.. не правильно записывает float что-ли
Код:
{$CLEO}
0000:

1@ = 100.0

:src
wait 0
if and
00DF:   actor $PLAYER_ACTOR driving
0ADC:   test_cheat "CRUIZ"
jf @src
00D9: 0@ = actor $PLAYER_ACTOR car // add to mission cleanup
:1
wait 0
if 0AB0: 107
jf @2
005B: 1@ += 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%d" time 500 1@
jump @src

:2
wait 0
if 0AB0: 109
jf @1
0063: 1@ -= 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%d" time 500 1@
jump @src

И 2 вопрос как эмуировать выстрел
 

zwhoz

Известный
106
11
CLEO:
{$CLEO}
0000:

:SAMPAv
wait 0
0AFA:  is_samp_available
jf @SAMPAv
0B80: dialog 0@ = create "MENU"
0B86: dialog 0@ set_visible 0
0B84: dialog 0@ set_pos_XY 500 500 size 300 225
0B82: dialog 0@ add_button id 1 text "0 hp" pos_XY 0 0 size 100 30
0B82: dialog 0@ add_button id 2 text "45 hp" pos_XY 0 25 size 100 30
0B82: dialog 0@ add_button id 3 text "100 hp" pos_XY 0 50 size 100 30
0B82: dialog 0@ add_button id 4 text "Text" pos_XY 0 75 size 100 30

:OnDialog
wait 0
0ADC:   test_cheat "ON"
jf @OnDialog
0B86: dialog 0@ set_visible 1
0B8D: samp set_cursor_mode 2

// Тут код после включения диалога.

:OffDialog
wait 0
0ADC:   test_cheat "OFF"
jf @OffDialog
0B86: dialog 0@ set_visible 0
0B8D: samp set_cursor_mode 0
jump @OnDialog

Или у меня руки кривые или что...
Диалог включается, но кнопки которые в диалоге уже не работают и так же не выключается диалог.
Вот тебе весь код, скажи в чём моя проблема
CLEO:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP

:Noname_2
wait 0
key_down 122
jf @Noname_2
SAMP.SetCursorMode(2)
Dialog.Create(0@, "MENU")
Dialog.SetRECT(0@, 500, 500, 300, 225)
Dialog.AddButton(0@, 1, "0 hp", 0, 0, 100, 30)
Dialog.AddButton(0@, 2, "45 hp", 0, 25, 100, 30)
Dialog.AddButton(0@, 3, "100 hp", 0, 50, 100, 30)
Dialog.AddButton(0@, 4, "GM", 0, 75, 100, 30)

:Noname_142
wait 0
0ADC:   test_cheat "ON"
jf @Noname_142
Dialog.SetVisible(0@, 1)
SAMP.SetCursorMode(2)

:Noname_170
wait 0
if
   Dialog.PopEvent(0@, 1@, 2@)
jf @Noname_657
if
  1@ == 257
jf @Noname_305
if
  2@ == 1
jf @Noname_305
chatmsg "Была нажата кнопка. Компонент №%d" -1 2@
alloc 3@ 128
Actor.Health($PLAYER_ACTOR) = 0
wait 300
SAMP.SetCursorMode(2)
free 3@

:Noname_305
if
  1@ == 257
jf @Noname_405
if
  2@ == 2
jf @Noname_405
chatmsg "Была нажата кнопка. Компонент №%d" -1 2@
alloc 3@ 128
Actor.Health($PLAYER_ACTOR) = 45
free 3@

:Noname_405
if
  1@ == 257
jf @Noname_505
if
  2@ == 3
jf @Noname_505
chatmsg "Была нажата кнопка. Компонент №%d" -1 2@
alloc 3@ 128
Actor.Health($PLAYER_ACTOR) = 100
free 3@

:Noname_505
if
  1@ == 257
jf @Noname_657
if
  2@ == 4
jf @Noname_657
chatmsg "Была нажата кнопка. Компонент №%d" -1 2@
alloc 3@ 128
print "~G~GodMode Activated!" 4000
Actor.SetImmunities($PLAYER_ACTOR, 1, 1, 1, 1, 1)
0A8C: write_memory 4928287 size 6 value -1869574000 virtual_protect 1
free 3@

:Noname_657
goto @Noname_170

:Noname_664
wait 0
0ADC:   test_cheat "OFF"
jf @Noname_664
Dialog.SetVisible(0@, 0)
SAMP.SetCursorMode(0)
goto @Noname_142
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,967
Или у меня руки кривые или что...
Диалог включается, но кнопки которые в диалоге уже не работают и так же не выключается диалог.
Вот тебе весь код, скажи в чём моя проблема
CLEO:
{$CLEO}
0000:

:SAMPAv
wait 0
0AFA:  is_samp_available
jf @SAMPAv
0B80: dialog 0@ = create "MENU"
0B86: dialog 0@ set_visible 0
0B84: dialog 0@ set_pos_XY 500 500 size 300 225
0B82: dialog 0@ add_button id 1 text "0 hp" pos_XY 0 0 size 100 30
0B82: dialog 0@ add_button id 2 text "45 hp" pos_XY 0 25 size 100 30
0B82: dialog 0@ add_button id 3 text "100 hp" pos_XY 0 50 size 100 30
0B82: dialog 0@ add_button id 4 text "Text" pos_XY 0 75 size 100 30

:OnDialog
wait 0
0ADC:   test_cheat "ON"
jf @OnDialog
0B86: dialog 0@ set_visible 1
0B8D: samp set_cursor_mode 2

:DialogMain
wait 0
0B81: dialog 0@ pop_event_to 1@ control_id_to 2@
2@ == 1
jf @DialogMain2
0223: set_actor $PLAYER_ACTOR health_to 0

:DialogMain2
2@ == 2
jf @DialogMain3
0223: set_actor $PLAYER_ACTOR health_to 45

:DialogMain3
2@ == 3
jf @DialogMain4
0223: set_actor $PLAYER_ACTOR health_to 100

:DialogMain4
2@ == 4
jf @OffDialog
0ACD: show_text_highpriority "TEXT" time 500

:OffDialog
0ADC:   test_cheat "OFF"
jf @DialogMain
0B86: dialog 0@ set_visible 0
0B8D: samp set_cursor_mode 0
jump @OnDialog
 
  • Нравится
Реакции: zwhoz

Vadim.dll

Известный
168
80
Черт подери всеровно краш

Код:
{$CLEO}
0000:

1@ = 100.0

:src
wait 0
if and
00DF:   actor $PLAYER_ACTOR driving
0ADC:   test_cheat "CRUIZ"
jf @src
03C0: 0@ = actor $PLAYER_ACTOR car
:1
wait 0
if 0AB0: 107
jf @2
005B: 1@ += 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%f" time 500 1@
jump @src

:2
wait 0
if 0AB0: 109
jf @1
0063: 1@ -= 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%f" time 500 1@
jump @src
 

DubStep_

Известный
292
52
Черт подери всеровно краш

Код:
{$CLEO}
0000:

1@ = 100.0

:src
wait 0
if and
00DF:   actor $PLAYER_ACTOR driving
0ADC:   test_cheat "CRUIZ"
jf @src
03C0: 0@ = actor $PLAYER_ACTOR car
:1
wait 0
if 0AB0: 107
jf @2
005B: 1@ += 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%f" time 500 1@
jump @src

:2
wait 0
if 0AB0: 109
jf @1
0063: 1@ -= 10.0  // (float)
00AD: set_car 0@ max_speed_to 1@
0AD1: show_formatted_text_highpriority "~G~%f" time 500 1@
jump @src
Тебе писали выше что этот опкод используется в путях (тобишь маршрутах)
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,967
ок.... тогда подскажите аналог
Не помню есть ли опкод на ограничение, но можно вот так например сделать.
CLEO:
{$CLEO}
0000:

:1
wait 0
00DF:   actor $PLAYER_ACTOR driving
jf @1
03C0: 0@ = actor $PLAYER_ACTOR car
02E3: 1@ = car 0@ speed
0031:   1@ >= 10.0
jf @1
04BA: set_car 0@ speed_to 10.0
jump @1
 

zwhoz

Известный
106
11
У меня есть диалоговое окно и кнопка.
CLEO:
Dialog.Create(0@, "MENU")
Dialog.SetRECT(0@, 500, 500, 100, 150)
Dialog.AddButton(0@, 1, "Ban", 0, 0, 100, 30)

При нажатии на кнопку появляется второе окно.
CLEO:
:Noname_188
wait 0
   Dialog.PopEvent(0@, 1@, 2@)
  2@ == 1
jf @Noname_224
0B80: dialog 1@ = create "BAN"
0B84: dialog 1@ set_pos_XY 500 700 size 100 150
0B88: dialog 1@ add_editbox id 3 text "" pos_XY 2 20 size 100 40
0B91: dialog 1@ add_static id 4 text "Введите ид" pos_XY 2 10 size 150 20

Первое окно выключается на клавиши 2 1.
CLEO:
:Noname_382
0ADC:   test_cheat "21"
jf @Noname_188
Dialog.SetVisible(0@, 0)
SAMP.SetCursorMode(0)
goto @Noname_160

Как сделать чтобы второе окно выключалось на кнопку?
CLEO:
Dialog.AddButton(1@, 2, "EXIT", 0, 125, 100, 30)

Я вот так сделал, но оно не работает.
CLEO:
:Noname_224
  2@ == 2
jf @Noname_245
Dialog.SetVisible(1@, 0)