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

hnnssy

Известный
Друг
2,684
2,748
CLEO:
<[/B]
{$CLEO .cs}
0000: NOP

:1
wait 0
if
0AB0:   key_preassed 1 //ëåâàÿ êíîïàêà ìûøè
jf @2
0AF8: samp_add_massage_to_chat "1" color 0xFFFFFF //лкм
wait 1000
jump @1

:2
wait 0
if
0AB0:   key_preassed 32 //ïðàâàÿ êíîïêà ìûøè
wait 1000
jf @3
0AF8: samp_add_massage_to_chat "2" color 0xFFFFFF //пкм
jump @1

:3
wait 0
if
0AB0:   key_preassed 3 //ïðîáåë
wait 1000
jf @1
0AF8: samp_add_massage_to_chat "3" color 0xFFFFFF //пробел
jump @1

[B]>
Когда я из txt файла преобразовываю в .cs или .asi путём (ПКМ-переименновать) и закидываю в cleo, то игра крашит, c txt файлом и файлом .ini всё работает спокойно, но сам скрипт нет. я новичёк и хочу чему то научиться. с ютуба брал код и не Понимаю, что не так делаю.
такс, чтобы превратить .txt файл в .cs, его нужно скомпилировать, а не переименовать, это клавиша F6 в Sanny Builder (это компилятор такой для клео)
.asi пишутся совсем на другом языке, поэтому пока что забудь про это
и беги с ютубканала, на котором ты взял этот код
 

Black Bird

Участник
40
15
Есть скрипт (По типу руки на кобуре, но с проверкой оружия). Если у игрока в руках тяж. оружие - то анимация армейской стойки - активируется.Проблема: анимацию видит только тот игрок, который тоже стоит с тяж. оружием (К примеру если вояка стоит с м4 и в анимации, то я анимацию не увижу, если возьму м4 - то буду видеть) Как можно исправить? Заранее извиняюсь за говнокод :)
CLEO:
{$CLEO .cs}

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

:NONAME_2
wait 0
if and
is_key_pressed 88
is_key_pressed 49
    not Actor.Driving($PLAYER_ACTOR)
    Player.CanMove($PLAYER_CHAR) = True
else_jump @NONAME_81
    0470: 1@ = actor $PLAYER_ACTOR current_weapon
if or
0039:   1@ == 25
0039:   1@ == 27
0039:   1@ == 30
0039:   1@ == 31
0039:   1@ == 33
0039:   1@ == 34
else_jump @NONAME_81
0812: AS_actor $PLAYER_ACTOR perform_animation "COLT45_FIRE_2HANDS" IFP "COLT45" framedelta 50.0 loopA 0 lockX 0 lockY 0 lockF 1 time 1 // versionB
jump  @NONAME_1

:NONAME_1
wait 0
if and
is_key_pressed 88
is_key_pressed 50
else_jump @NONAME_0
jump @NONAME_3


:NONAME_0
if  0611: actor $PLAYER_ACTOR performing_animation "COLT45_FIRE_2HANDS"
jf @NONAME_81
0470: 5@ = actor $PLAYER_ACTOR current_weapon     
if or
0039:   5@ == 25
0039:   5@ == 27
0039:   5@ == 30
0039:   5@ == 31
0039:   5@ == 33
0039:   5@ == 34
else_jump @NONAME_3
jump @NONAME_1

:NONAME_3
  0812: AS_actor $PLAYER_ACTOR perform_animation "HIT_WALK" IFP "PED" framedelta 6.0 loopA 0 lockX 1 lockY 1 lockF 0 time 1 // versionB
0393: actor $PLAYER_ACTOR perform_animation "HIT_WALK" at 18.0 times_normal_rate
jump @NONAME_81

:NONAME_81
jump @NONAME_2
P.S. Знаю что надо поменять строку под номером 14, но как изменить - я понятия не имею :(
 

masterslaves

Потрачен
55
14
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Возможно ли в этой функции поставить какую нибудь костыльную проверку на клист игрока и уровень по сравнению с игроком (выше/ниже игрока) ?
CLEO:
075B: 99
- приближение радара ес че
 

Artiom_Konti

Новичок
14
9
помогите пожалуйста, у меня скрипт не роботает, он должен открывать/закрывать машину на букву L и вытаскивать/вставлять ключи на букву k
{$CLEO .cs}
0000:NOP

wait 3000


:lock
wait 0
if and
0AB0: key_pressed 76
0AF9: samp say_msg "/lock"
wait 200
jump @lock


:key
wait 0
if and
0AB0: key_pressed 75
0AF9: samp say_msg "/key"
wait 200
 
У

Удалённый пользователь 123482

Гость
помогите пожалуйста, у меня скрипт не роботает, он должен открывать/закрывать машину на букву L и вытаскивать/вставлять ключи на букву k
{$CLEO .cs}
0000:NOP

wait 3000


:lock
wait 0
if and
0AB0: key_pressed 76
0AF9: samp say_msg "/lock"
wait 200
jump @lock


:key
wait 0
if and
0AB0: key_pressed 75
0AF9: samp say_msg "/key"
wait 200
CLEO:
{$CLEO .CS}
0000: NOP

REPEAT
0001: WAIT 0 MS
UNTIL 0AFA:  is_samp_available

WHILE TRUE
0001: WAIT 0 MS
    IF 0C89:  key_just_pressed 0x4B
    THEN 0AF9: samp say_msg "/key"
    END
    IF 0C89:  key_just_pressed 0x4C
    THEN 0AF9: samp say_msg "/lock"
    END
END
 

Artiom_Konti

Новичок
14
9
CLEO:
{$CLEO .CS}
0000: NOP

REPEAT
0001: WAIT 0 MS
UNTIL 0AFA:  is_samp_available

WHILE TRUE
0001: WAIT 0 MS
    IF 0C89:  key_just_pressed 0x4B
    THEN 0AF9: samp say_msg "/key"
    END
    IF 0C89:  key_just_pressed 0x4C
    THEN 0AF9: samp say_msg "/lock"
    END
END
не робит, в чат warning летит, не работает((
 
Последнее редактирование:

ShadowBroker

Известный
110
27
Помогите адаптировать этот кусок кода под клео
Code:
cast('unsigned char *', 0x005609FF)[0] = 0xEB
cast('unsigned char *', 0x00561344)[0] = 0xEB

Code:
script_author('LUCHARE')
script_url('blast.hk')

local inicfg = require 'inicfg'
local ffi = require 'ffi'

local cfg = inicfg.load(
    {
        general = {
            dist = 1200.0;
            cmd_alias = 'fd';
        }
    },
    'fogdist'
)
local settings = cfg.general

local cast = ffi.cast
local draw_dist = cast('float *', 0x00B7C4F0)
cast('unsigned char *', 0x005609FF)[0] = 0xEB
cast('unsigned char *', 0x00561344)[0] = 0xEB

function set_fog_dist(m)
    if m > 3600.0 or m < 0 then return false end
    draw_dist[0] = m
    settings.dist = m
    return true
end

function cmdproc_set_fog_dist(param)
    param = tonumber(param)
    if param ~= nil then
        if not set_fog_dist(param) then
            sampAddChatMessage('[FogDist] {FFFFFF}Incorrect value', 0xFF5000)
        end
    end
end

function main()
    while not isSampAvailable() do wait(100) end
    -- default command
    sampRegisterChatCommand('fogdist', cmdproc_set_fog_dist)
    -- user-defined command
    local udc = settings.cmd_alias
    if udc then
        sampRegisterChatCommand(udc, cmdproc_set_fog_dist)
    end
    -- apply saved distance
    set_fog_dist(settings.dist)

    sampAddChatMessage('[FogDist] {FFFFFF}LUCHARE says hello', 0xFF5000)
    wait(-1)
end

function onScriptTerminate(script, quitGame)
    if script == thisScript() then
        inicfg.save(cfg, 'fogdist')
    end
end
 
У

Удалённый пользователь 123482

Гость
Помогите адаптировать этот кусок кода под клео
Code:
cast('unsigned char *', 0x005609FF)[0] = 0xEB
cast('unsigned char *', 0x00561344)[0] = 0xEB

Code:
script_author('LUCHARE')
script_url('blast.hk')

local inicfg = require 'inicfg'
local ffi = require 'ffi'

local cfg = inicfg.load(
    {
        general = {
            dist = 1200.0;
            cmd_alias = 'fd';
        }
    },
    'fogdist'
)
local settings = cfg.general

local cast = ffi.cast
local draw_dist = cast('float *', 0x00B7C4F0)
cast('unsigned char *', 0x005609FF)[0] = 0xEB
cast('unsigned char *', 0x00561344)[0] = 0xEB

function set_fog_dist(m)
    if m > 3600.0 or m < 0 then return false end
    draw_dist[0] = m
    settings.dist = m
    return true
end

function cmdproc_set_fog_dist(param)
    param = tonumber(param)
    if param ~= nil then
        if not set_fog_dist(param) then
            sampAddChatMessage('[FogDist] {FFFFFF}Incorrect value', 0xFF5000)
        end
    end
end

function main()
    while not isSampAvailable() do wait(100) end
    -- default command
    sampRegisterChatCommand('fogdist', cmdproc_set_fog_dist)
    -- user-defined command
    local udc = settings.cmd_alias
    if udc then
        sampRegisterChatCommand(udc, cmdproc_set_fog_dist)
    end
    -- apply saved distance
    set_fog_dist(settings.dist)

    sampAddChatMessage('[FogDist] {FFFFFF}LUCHARE says hello', 0xFF5000)
    wait(-1)
end

function onScriptTerminate(script, quitGame)
    if script == thisScript() then
        inicfg.save(cfg, 'fogdist')
    end
end
0C11: memset destination 0@ value 1@ size 0x4
 

ShadowBroker

Известный
110
27
Может кто протестить? А то у меня чот крашит, мб конфликтует с чем-то.
CLEO:
{$CLEO}

0000:

repeat
wait 100
until SAMP.Available()

0B34: samp register_client_command "fogdist" to_label @fogdist

3@ = 200.0
0C11: memset destination 0x005609FF value 0 size 0xEB
0C11: memset destination 0x00561344 value 0 size 0xEB

while true
wait 0
0A8C: write_memory 0x00B7C4F0 size 4 value 3@ virtual_protect 1
end

:fogdist
0B35: samp 0@ = get_last_command_params
    if 0AD4: 2@ = scan_string 0@ format "%d" 1@
    then
    008F: 3@ = integer 1@ to_float
    0A8C: write_memory 0x00B7C4F0 size 4 value 3@ virtual_protect 1
    chatmsg "Fog changed to %d" 0xff5000 1@ 
    end
SAMP.CmdRet()
 

Вложения

  • csFogDistance.cs
    17.9 KB · Просмотры: 5

D3.Pheonix

🎹
Модератор
2,817
1,599
Может кто протестить? А то у меня чот крашит, мб конфликтует с чем-то.
Скачай FixDist by SR_Team, и тогда твой код будет выглядеть так:
CLEO:
{$CLEO}
0000:

repeat
wait 100
until SAMP.Available()
0B34: samp register_client_command "fogdist" to_label @fogdist
0BDE: pause_thread 0

:fogdist
0B35: samp 0@ = get_last_command_params
    if 0AD4: 2@ = scan_string 0@ format "%d" 1@
    then
    008F: 3@ = integer 1@ to_float
    0A8C: write_memory 0x00B7C4F0 size 4 value 3@ virtual_protect 1
    chatmsg "Fog changed to %d" 0xff5000 1@ 
    end
SAMP.CmdRet()
 

ShadowBroker

Известный
110
27
Он есть. Там немного в другом дело. Когда стоишь под каким-то навесом прорисовка сбрасывается, т.е. игнорируется заданный параметр дальности. LUCHARE пофиксил это в своем скрипте, я посмотрел его код и предположил, что эти две строки и являются фиксом, так как там по сути больше ничего нет.
 

MAHEKEH

Известный
1,989
494
Как получить позицию модели пикапа?

2021-04-08_170730.jpg
 

MAHEKEH

Известный
1,989
494
Попробуй опкод 065B, если ты уже получил его id

да пробовал вроде, уже не помню, голова не соображает. Там этого одного опкода явно маловато будет, опять чет очевидное упускаю, на отдых пойду.
Код ниже оставлю если любопытно.

Код:
{$CLEO .cs}
0000:
0001: 1500
0B34: samp register_client_command "ff" to_label @cmd
alloc 0@ 200
0B6D: render 1@ = create_font "Arial Black" height 8 flags 5
0AC6: 3@ = label @1 offset


while true
0001: 0
    if 2@ == 1                                                                                                               
        then                                                                                                                                 
        for 4@ = 0 to 4096                                                                                                                   
            6@ = 0x9788C0                                                                                                                   
            if 0B51: samp 5@ = pickup_handle_by_id 4@                                                                                       
                then                                                                                                                         
                065B: store_pickup 5@ position_to 7@ 8@ 9@                                                                               
                if 00C2:   sphere_onscreen 7@ 8@ 9@  radius 0.0                                                                           
                then                                                                                                                     
                Actor.StorePos($PLAYER_ACTOR, 10@, 11@, 12@)                                                                             
                0B55: convert_3D_coords 7@ 8@ 9@ to_screen 13@ 14@                                                                     
                0B55: convert_3D_coords 10@ 11@ 12@ to_screen 17@ 18@                                                                     
                0B68: render draw_line_point1 13@ 14@ point2 17@ 18@ width 1 color 0x88fff333                                                                                             
                0B70: render draw_polygon_pos 13@ 14@ size 3 3 corners 7 rotation 0 color 0xbafff000                                     
                0A8E: 16@ = 6@ + 24                                                         
                0A8D: 15@ = read_memory 16@ size 2 virtual_protect 0                                                       
                065B: store_pickup 15@ position_to 19@ 20@ 21@                                                                                                                         
                format 0@ "{808080}Èä: {ff0000}%d {808080}Ìîäåëü: {ff0000}%d {808080}[!]: {ff0000}%d %d %d" 4@ 15@ 19@ 20@ 21@
                13@ += 5                                                                                                                 
                14@ -= 7                                                                                                                 
                0B6F: render font 1@ draw_text 0@ pos 13@ 14@ color 0xcaf4f4c1                                                           
                end                                                                                                                           
            end                                                                                                                               
        end
    end   
end

:cmd
0B12: 2@ = 2@ XOR 1
0B43: samp cmd_ret

:1                                                                                                                         
hex                                                                                                                                                                     
70 31 63 61 64 6f 72 3a 20 70 69 63 6b 75 70 20 73 63 61 6e 6e 65 72 20 4f 4e 00 70 31 63 61 64 6f 72 3a 20 70 69 63 6b 75 70 20 73 63 61 6e 6e 65 72 20 4f 46 46 00                                                                                                                                     
end