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

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,957
чёт намудрил с кавычками ты
0AD3: 0@ = format "%i" 2@ и всё
 

Woofing Giraffe

Активный
402
49
чёт намудрил с кавычками ты
0AD3: 0@ = format "%i" 2@ и всё
Результат:
r9qxyOk.png
 

Woofing Giraffe

Активный
402
49
Хотя даже если юзать так, ничего не меняется:
Код:
1@ += 1
0C1C: 0@ = itoa 1@ radix 10
0AF5: write_string 2@ to_ini_file "cleo\kek.ini" section "kek" key 0@
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,957
Как определить координаты игрока по хендлу или айди?
Так вот для handle:

PHP:
04C4: store_coords_to 0@ 1@ 2@ from_actor 0@ with_offset 0.0 0.0 0.0

Так вот для ID (вместо 420 ID):

PHP:
0B20: samp 0@ = actor_handle_by_samp_player_id 420
04C4: store_coords_to 0@ 1@ 2@ from_actor 0@ with_offset 0.0 0.0 0.0
 
  • Нравится
Реакции: Sire Like и _Viktor_

AWRage

Активный
642
141
У меня есть полоска ХП. Нужно, чтобы при нажатии кнопки (например F7) эта полоска убиралась, а при повторном нажатии F7 - появлялась. Что нужно дописать в .cs файле?
Код:
{$CLEO .cs}

0000: NOP
thread "HP"

:HP
wait 0
0@ = Actor.Health($PLAYER_ACTOR)

if
   not 0@ >= 100
jf @HP
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 51 position 97.5 403.0 size 194.5 89.0 RGBA 60 0 0 255
if
   not 0@ >= 50
jf @HP
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 52 position 97.5 403.0 size 194.5 89.0 RGBA 60 0 0 255
jump @HP
 

OtherWeather

Новичок
39
2
Скомпилировал, проверил - всё работает отлично. На след. день работать скрипт перестал. Ничего не изменял, в других скриптах/программах эта клавиша не занята.
Код:
{$CLEO .cs}
THREAD "AUTOFRISK"

:START
wait 0
if
0AB0:   key_pressed 97
jf @START
if
0AB1: call @get_id_nearest_player 0 retr_to fdist 0@ sid 1@
jf @START
0AF9: "/frisk %d" 1@
wait 100
0C72: set_virtual_key 0x7A down true
wait 100
0C72: set_virtual_key 0x7A down false
wait 1000
jump @START

:get_id_nearest_player
// FOR ALL PEDS
3@ = 1000.0 // Max. distance
4@ = 0xFFFFFF // Nearest player handle / id
0A8D: 0@ = read_memory 0xB74490 size 4 virtual_protect 0
0@ += 4
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
for 1@ = 0 to 35584 step 0x100
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    0@++
    if and
        2@ >= 0x00
        2@ < 0x80
    then
        005A: 2@ += 1@
        if or
            003C: $PLAYER_ACTOR == 2@ // LOCAL_PLAYER == REMOTE_PLAYER
            856D: NOT actor 2@ defined // REMOTE PLAYER IS NOT DEFINED
        then continue
        end
   
        0AB1: call @distanceBetweenActor 1 remote_player_handle 2@ retr_dist_to 5@
        if 0025: 3@ > 5@ // Max. dist > cur.
        then
            0087: 3@ = 5@ // Max. dist = cur.
            0085: 4@ = 2@ // Save remote player handle
        end
    end
end
if 4@ = SAMP.GetSAMPPlayerIDByActorHandle(4@)
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: ret 2 3@ 4@
:distanceBetweenActor
Actor.StorePos(0@, 1@, 2@, 3@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
050A: 7@ = distance_between_XYZ 4@ 5@ 6@ and_XYZ 1@ 2@ 3@
0AB2: ret 1 7@
 

Vadim.dll

Известный
168
80
Крашит, мб я неправильно записываю
Код:
:zapis
wait 0
if 1@ == true
jf @zapis
0A8E: 5@ = 5@ + 1 // int
Actor.StorePos($Player_Actor, 2@, 3@, 4@)
0AD9: write_formatted_text "%dx-%d y-%d z-%d" in_file botg.ini 5@ 2@ 3@ 4@
wait 500
jump @zapis
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,695
1,448
Хех.
botg.ini вместо этого должен быть указатель на открытый файл, который возвращается опкодом 0A9A.
 

Vadim.dll

Известный
168
80
А как считать информацию с форматированием?
И там в 0A9A есть настройка mode, что там вписывать?
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,957
И там в 0A9A есть настройка mode, что там вписывать?
PHP:
Parameters:
1 = variable to store the file handle
2 = file name. If the path is relative, the file is open in accordance with the current directory (opcode 0A99).
3 = file open mode:
0x6272 - opens binary file for reading
0x72 - opens text file for reading
0x6277 - opens binary file for writing
0x77 - opens text file for writing


CLEO 4 Specialities

CLEO 4 simplifies the task of setting the mode using standard methods.

You can replace the mode parameter with a string to specify the opening mode. If you don't use a string, the CLEO 3 opening mode will be used.

"rb" = read binary file
"wb" = write binary file
"wb+" = write binary file (create it if it doesn't exist)
"ab" = append binary file (write at the end)
"ab+" = append binary file (create it if it doesn't exist)
"rt" = read text file
"wt" = write text file
"wt+" = write text file (create it if it doesn't exist)
"at" = append text file
"at+" = append text file (create it if it doesn't exist)
"rb+" = read/write binary file
"rt+" = read/write text file
 
  • Нравится
Реакции: Sire Like

Vadim.dll

Известный
168
80
Что здесь не правильно?
Код:
:zapis
wait 0
if 1@ == true
jf @zapis
0A8E: 5@ = 5@ + 1 // int
Actor.StorePos($Player_Actor, 2@, 3@, 4@)
0A9A: $hFILE = openfile "botg.ini" mode 0x77  // IF and SET
0AD9: write_formatted_text "%dx-%d y-%d z-%d" in_file $hFILE 5@ 2@ 3@ 4@
jump @zapis
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,957
во первых не юзай глобальные переменные, во вторых закрывай файл после открытия, в третьих координаты это float значит %f
 
  • Нравится
Реакции: Sire Like

Vadim.dll

Известный
168
80
Сделал вот так, всеровно не записывает

Код:
:zapis
wait 0
if 1@ == true
jf @zapis
0A8E: 5@ = 5@ + 1 // int
Actor.StorePos($Player_Actor, 2@, 3@, 4@)
0A9A: 7@ = openfile "botg.ini" mode 0x77  // IF and SET
0AD9: write_formatted_text "%dx-%f y-%f z-%f" in_file 7@ 5@ 2@ 3@ 4@
jump @zapis