Другое Полезные сниппеты и SCM-функции

Mark91

Новичок
23
2
Код:
call @SendInCarPosSync 3 1@ 2@ 3@

:SendInCarPosSync                
3@ = SAMP.GetSAMPPlayerIDByActorHandle($PLAYER_ACTOR)
3 = SAMP.GetPlayerStruct @ (@ 3)
3@ += 170
0AC8: 4@ = allocate_memory_size 63
0C10: memcpy destination 4@ source 3@ size 63
0C0D: struct 4@ offset 24 size 4 = 0@
0C0D: struct 4@ offset 28 size 4 = 1@
0C0D: struct 4@ offset 32 size 4 = 2@
0B3D: raknet 5@ = new_bit_stream
RakNet.Write (5 @ 200, BS_TYPE_BYTE, 1)
RakNet.Write(5@, 4@, BS_TYPE_ARRAY, 63)
0B8B: raknet send bit_stream 5@                
0B3E: raknet delete_bit_stream 5@
0AC9: 4@
0AB2: right 0

Will send desired Incar Position Sync to the server.
 

Opcode.eXe

Известный
84
112
Sets a new position and size of the minimized gta_sa window handle.
Код:
0AB1: @SET_WINDOW_POS_AND_SIZE 4 pos_x 50 pos_y 40 width 400 width 400
:SET_WINDOW_POS_AND_SIZE
0A8D: 31@ = 0xC9C060 4 0
IF
31@ == TRUE
THEN
  0AA2: 30@ = load_library "User32.dll"
  0AA4: 29@ = get_proc_address "MoveWindow" library 30@
  0A8D: 28@ = 0xC97C1C 4 0
  0AA7: call_function 29@ params 6 pop 0 TRUE 3@ 2@ 1@ 0@ 28@ 29@  
END
0AB2: 0
 
  • Нравится
Реакции: DubStep_

Mark91

Новичок
23
2
SendFakeBulletSync for 0.3.7

Код:
call @SendFakeBulletSync 1 0@

: SendFakeBulletSync
0B20: samp 9@ = actor_handle_by_samp_player_id 0@
0470: 16@ = $PLAYER_ACTOR
Actor.StorePos($PLAYER_ACTOR, 10@ 11@ 12@)
Actor.StorePos(9@, 13@ 14@ 15@)
0AC8: 5@ = allocate_memory_size 40
0C0D: struct 5@ offset 0 size 1 = 1 //type shot: 0 - in air, 1 - in player, 2 - in car
0C0D: struct 5@ offset 1 size 2 = 0@ //player/car id (65535 for type 0)
0C0D: struct 5@ offset 3 size 4 = 10@ //You X
0C0D: struct 5@ offset 7 size 4 = 11@ //You Y
0C0D: struct 5@ offset 11 size 4 = 12@ //You Z
0C0D: struct 5@ offset 15 size 4 = 13@ //Target X
0C0D: struct 5@ offset 19 size 4 = 14@ //Target Y
0C0D: struct 5@ offset 23 size 4 = 15@ //Target Z
0C0D: struct 5@ offset 39 size 1 = 16@ // weapon ID
0C0D: struct 5@ offset 27 size 4 = 0.0 //Offset X
0C0D: struct 5@ offset 31 size 4 = 0.0 //Offset Y
0C0D: struct 5@ offset 35 size 4 = 0.5 //Offset Z. 0.5 will hit the head, make it 0.0 for the body
0B3D: raknet 6@ = new_bit_stream
0B40: raknet bit_stream 6@ write 206 type 0 size 1
0B40: raknet bit_stream 6@ write 5@ type 5 size 40
0B8B: raknet send bit_stream 6@
0B3E: raknet delete_bit_stream 6@
0AC9: free_allocated_memory 5@
0AB2: right 0

Will send fake bullet sync to the designated victim id and the victim will lose health if the sender has a weapon which can fire bullets, else if the sender doesn't have any weapons, then it will freeze the victim's movements i.e. he won't be able to move.
--------------------------------------------------------------------------------------------------------------
Will send feykovye bullets into the specified target and diminish life, if the weapon id id sent weapons fire bullets, otherwise it will just stun Player
 
Последнее редактирование:

Mark91

Новичок
23
2
SendIncarFakeSpeedSync for 0.3.7

Код:
call @SendIncarFakeSpeedSync 4 1@ 2@ 3@ 4@  // 1@ 2@ 3@ are the positions and 4@ being the vehicle id

: SendIncarFakeSpeedSync
4@ = SAMP.GetSAMPPlayerIDByActorHandle($PLAYER_ACTOR)
4 = SAMP.GetPlayerStruct @ (@ 4)
4@ += 170
0AC8: 5@ = allocate_memory_size 63
0C10: memcpy destination 5@ source 4@ size 63
0C0D: struct 5@ offset 36 size 4 = 6.0
0C0D: struct 5@ offset 40 size 4 = 6.0 // lower the value if the server has a speed limit on vehicles
0C0D: struct 5@ offset 44 size 4 = 6.0
0B3D: raknet 6@ = new_bit_stream
0B40: raknet bit_stream 6@ write 200 type 0 size 1
0B40: raknet bit_stream 6@ write 5@ type 5 size 63
0B42: raknet send bit_stream 6@ priority 1 reliability 7 ordering_channel 0
0B3E: raknet delete_bit_stream 6@
0AC9: free_allocated_memory 5@
0AB2: right 0

Useful for making CLEO hacks such as speedkicker/pizdarvanka and useful in servers where server kicks you for idling inside your vehicle, this will send fake speed and fool the server into thinking that you're driving the vehicle with some speed when you're simply sitting inside the car.
 
Последнее редактирование:

Niko

Известный
Проверенный
230
270
SendOnFootFakePosition для 0.3.7

Вызов:
Код:
0AB1: call_scm_func @SendOnfootFakePosition 3 1@ 2@ 3@

Функция:
Код:
:SendOnFootFakePosition
3@ = SAMP.GetSAMPPlayerIDByActorHandle($PLAYER_ACTOR) 
3@ = SAMP.GetPlayerStruct(3@) 
3@ += 109 
0AC8: 4@ = allocate_memory_size 68
0C10: memcpy destination 4@ source 3@ size 68 
0C0D: struct 4@ offset 6 size 4 = 0@ 
0C0D: struct 4@ offset 10 size 4 = 1@ 
0C0D: struct 4@ offset 14 size 4 = 2@ 
0B3D: raknet 5@ = new_bit_stream 
0B40: raknet bit_stream 5@ write PACKET_PLAYER_SYNC type BS_TYPE_BYTE size 1 
0B40: raknet bit_stream 5@ write 4@ type 5 size 68 
0B42: raknet send bit_stream 5@ priority HIGH_PRIORITY reliability UNRELIABLE_SEQUENCED ordering_channel 0 
0B3E: raknet delete_bit_stream 5@
0AC9: free_allocated_memory 4@ 
0ab2: 0
 

Mark91

Новичок
23
2
SendUnOccupiedVehicleSync for 0.3.7

Код:
call @SendUnOccupiedVehicleSync 4 1@ 2@ 3@ 4@

:SendUnOccupiedVehicleSync
7@ = SAMP.GetSAMPVehicleIDByCarHandle(0@)
Car.PutAt(0@, 1@, 2@, 3@)
alloc 4@ 67 
0C0D: struct 4@ offset 0 size 2 = 7@ 
0C0D: struct 4@ offset 2 size 1 = 1 
0C0D: struct 4@ offset 3 size 4 = -1.0 
0C0D: struct 4@ offset 7 size 4 = -0.01 
0C0D: struct 4@ offset 11 size 4 = 0.05 
0C0D: struct 4@ offset 15 size 4 = 0.09 
0C0D: struct 4@ offset 19 size 4 = -1.0 
0C0D: struct 4@ offset 23 size 4 = 0.02 
0C0D: struct 4@ offset 27 size 4 = 1@ 
0C0D: struct 4@ offset 31 size 4 = 2@ 
0C0D: struct 4@ offset 35 size 4 = 3@ 
0C0D: struct 4@ offset 39 size 4 = 0.0 
0C0D: struct 4@ offset 43 size 4 = 0.0 
0C0D: struct 4@ offset 47 size 4 = 400.0 
0C0D: struct 4@ offset 51 size 4 = 0.0 
0C0D: struct 4@ offset 55 size 4 = 0.0 
0C0D: struct 4@ offset 59 size 4 = 0.0 
0C0D: struct 4@ offset 63 size 4 = 1000.0 
5@ = RakNet.NewBitStream()
BitStream.Write(5@, 209, BS_TYPE_BYTE, 1)
BitStream.Write(5@, 4@, BS_TYPE_ARRAY, 67)
RakNet.LiteSend(5@)
RakNet.DeleteBitStream(5@)
free 4@ 
ret 0
 

Mark91

Новичок
23
2
SendFakeSpecSync 0.3.7

Код:
call @SendFakeSpecSync 3 0@ 1@ 2@

:SendFakeSpecSync
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
alloc 3@ 18
0C0D: struct 3@ offset 0 size 2 = 0 // sLeftRightKeys;
0C0D: struct 3@ offset 2 size 2 = 0 // sUpDownKeys;
0C0D: struct 3@ offset 4 size 2 = 0 // sKeys;
0C0D: struct 3@ offset 6 size 4 = 0@ //fPosition[X];
0C0D: struct 3@ offset 10 size 4 = 1@ // fPosition[Y];
0C0D: struct 3@ offset 14 size 4 = 2@ //fPosition[Z];
0B3D: raknet 4@ = new_bit_stream 
0B40: raknet bit_stream 4@ write 212 type 0 size 1
0B40: raknet bit_stream 4@ write 3@ type 5 size 18 
0B8B: raknet send bit_stream 4@                 
0B3E: raknet delete_bit_stream 4@
free 3@
ret 0

Useful for trolling admins with your fake spectator mode.
 

Niko

Известный
Проверенный
230
270
Описание: проверяет на то что, оружие поменялось, а так же возвращает старое оружие и новое
Использование: (как условие) 0AB1: call_scm_func @ChangedWeapon 0 OldWeapon 0@ NewWeapon 1@
Код:
Код:
:ChangedWeapon
var
    0@ : int
    1@ : int
end

0470: 0@ = actor $PLAYER_ACTOR current_weapon
 
repeat
wait 0
0470: 1@ = actor $PLAYER_ACTOR current_weapon
until not 0@ == 1@

0485:  return_true
0AB2: ret 2 0@ 1@
Пример:
Код:
{$CLEO}
0000:

while not Samp.Available()
    wait 400
end

while true
    wait 0
  
    if 0AB1: call_scm_func @ChangedWeapon 0 OldWeapon 0@ NewWeapon 1@
    then
        0af8: "Old weapon: %d. New weapon: %d" -1 0@ 1@
    end
end

:ChangedWeapon
var
    0@ : int
    1@ : int
end

0470: 0@ = actor $PLAYER_ACTOR current_weapon
  
repeat
wait 0
0470: 1@ = actor $PLAYER_ACTOR current_weapon
until not 0@ == 1@

0485:  return_true
0AB2: ret 2 0@ 1@
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,983
Описание: Открывает дисковод ;D.
Использование: 0AB1: call_scm_func @mciSendString 0

CLEO:
:mciSendString
0AA2: 25@ = load_library "Winmm.DLL"
0AA4: 26@ = get_proc_address "mciSendStringA" library 25@
0AA7: call_function 26@ num_params 4 pop 0 0 0 0 "Set cdaudio door open wait" 27@
0AA3: free_library 25@
0AB2: ret 0

Описание: Закрывает дисковод .
Использование: 0AB1: call_scm_func @mciSendString 0

CLEO:
:mciSendString
0AA2: 25@ = load_library "Winmm.DLL"
0AA4: 26@ = get_proc_address "mciSendStringA" library 25@
0AA7: call_function 26@ num_params 4 pop 0 0 0 0 "Set cdaudio door closed wait" 27@
0AA3: free_library 25@
0AB2: ret 0
 

Niko

Известный
Проверенный
230
270
Описание: при нажатии определённых клавиш, изменяет нумерацию переменной. Если переменная становится больше указании (Maх), то переходит к нулю, а если меньше 0, то изменяет на максимальную. В общем в примере будет всё понятно :D
Использование: (как условие) 0AB1: @List 4 KeyList_1 38 KeyList_2 40 KeyPressed 13 Max 1 Reply 0@ 1@
Код:
CLEO:
:List
7@ = 0 // Reply

0AC6: 5@ = label @Buffer offset
0A8D: 6@ = read_memory 5@ size 1 virtual_protect 0

if 0ab0: 0@
then
    6@ += 1
    if 001D: 6@ > 3@
    then
        6@ = 0
    end
    0A8C: write_memory 5@ size 1 value 6@ virtual_protect 0
    7@ = 0
    0485:  return_true
    ret 2 6@ 7@
end

if 0ab0: 1@
then
    6@ -= 1
    if 6@ < 0
    then
        0085: 6@ = 3@
    end
    0A8C: write_memory 5@ size 1 value 6@ virtual_protect 0
    7@ = 0
    0485:  return_true
    ret 2 6@ 7@
end
if 0ab0: 2@
then
    7@ = 1
    0485:  return_true
    ret 2 6@ 7@   
end

059A:  return_false
ret 2 -1 -1

:Buffer
hex
    00
end
Пример:
CLEO:
{$CLEO}
0000:

while true
    wait 0

    if 0ADC: test_cheat "DGUN"
    then
        0B12: 0@ = 0@ XOR 1
    end
    if 0@ == 1
    then
        if 1@ == 0
        then
            print "AK-47" 1000
            if 2@ == 1
            then
                Model.Load(#AK47)
                01B2: give_actor $PLAYER_ACTOR weapon 30 ammo 1000
                2@ = 0
            end
        end
        if 1@ == 1
        then
            print "M4" 1000
            if 2@ == 1
            then
                Model.Load(#M4)
                01B2: give_actor $PLAYER_ACTOR weapon 31 ammo 1000
                2@ = 0
            end
        end
        if 1@ == 2
        then
            print "Minigun" 1000
            if 2@ == 1
            then
                Model.Load(#MINIGUN)
                01B2: give_actor $PLAYER_ACTOR weapon 38 ammo 1000
                2@ = 0
            end
        end
        if call @List 4 KeyList_1 38 KeyList_2 40 KeyPressed 13 Max 2 Reply 1@ 2@
        then
            wait 100
        end
    end
end

:List
7@ = 0 // Reply

0AC6: 5@ = label @Buffer offset
0A8D: 6@ = read_memory 5@ size 1 virtual_protect 0

if 0ab0: 0@
then
    6@ += 1
    if 001D: 6@ > 3@
    then
        6@ = 0
    end
    0A8C: write_memory 5@ size 1 value 6@ virtual_protect 0
    7@ = 0
    0485:  return_true
    ret 2 6@ 7@
end

if 0ab0: 1@
then
    6@ -= 1
    if 6@ < 0
    then
        0085: 6@ = 3@
    end
    0A8C: write_memory 5@ size 1 value 6@ virtual_protect 0
    7@ = 0
    0485:  return_true
    ret 2 6@ 7@
end
if 0ab0: 2@
then
    7@ = 1
    0485:  return_true
    ret 2 6@ 7@    
end

059A:  return_false
ret 2 -1 -1

:Buffer
hex
    00
end
 
Последнее редактирование:

SR_team

like pancake
BH Team
4,804
6,475
Описание: возвращает число, на которое нужно минусовать, что бы получить какое-то число ;D
Параметры:
number(in):
число, которое нужно минусовать
get(in): число, которое нужно получить
to(out): выходное число, на которое нужно минусовать

CLEO:
:GetNumber
// call @GetNumber 2 number 10 get 5 to 1@
for 2@ = 0 to 0@
    0085: 3@ = 0@
    0062: 3@ -= 2@
    if 003B: 3@ == 1@
    then
        ret 1 2@
    end
end
ret 1 -1
Извращенец.
:GetNumber
0062: 0@ -= 1@
ret 0@
 
  • Нравится
Реакции: DarkP1xel

hnnssy

Известный
Друг
2,684
2,762
Удаляет указанное количество символов со строки из конца.
CLEO:
:delete_last_chars_from_string
// call @delete_last_chars_from_string call  2 0@ 5
var
0@: int
1@: int
2@: int
end
0C17: 2@ = strlen 0@
2@ -= 1@
0@ += 2@
0C11: memset 0@ 0 1@
ret 0
 

FYP

Известный
Администратор
1,763
5,914
Описание: массив координат для самых маленьких.
увидел такое убожество и не смог ничего с собой поделать:
CLEO:
:Noname_496
{496} 0001: wait 0 ms
{500} 00D6: if
{504} 0039:  0@ == 0
{511} 004D: jump_if_false @Noname_548
{518} 0007: 1@ = 1833.0
{528} 0007: 2@ = -1844.0
{538} 0007: 3@ = 13.58

:Noname_548
{548} 00D6: if
{552} 0039:  0@ == 1
{559} 004D: jump_if_false @Noname_596
{566} 0007: 1@ = 1836.0
{576} 0007: 2@ = -1685.0
{586} 0007: 3@ = 13.35

:Noname_596
{596} 00D6: if
{600} 0039:  0@ == 2
{607} 004D: jump_if_false @Noname_644
{614} 0007: 1@ = 1845.92
{624} 0007: 2@ = -1869.96
{634} 0007: 3@ = 13.57

:Noname_644
{644} 00D6: if
{648} 0039:  0@ == 3
{655} 004D: jump_if_false @Noname_692
{662} 0007: 1@ = 1930.0
{672} 0007: 2@ = -1778.0
{682} 0007: 3@ = 13.55

:Noname_692
{692} 00D6: if
{696} 0039:  0@ == 4
{703} 004D: jump_if_false @Noname_740
{710} 0007: 1@ = 2311.29
{720} 0007: 2@ = -1645.0
{730} 0007: 3@ = 14.83

:Noname_740
{740} 00D6: if
{744} 0039:  0@ == 5
{751} 004D: jump_if_false @Noname_788
{758} 0007: 1@ = 2267.13
{768} 0007: 2@ = -1668.86
{778} 0007: 3@ = 15.39

:Noname_788
{788} 00D6: if
{792} 0039:  0@ == 6
{799} 004D: jump_if_false @Noname_836
{806} 0007: 1@ = 2247.0
{816} 0007: 2@ = -1664.81
{826} 0007: 3@ = 15.48

:Noname_836
{836} 00D6: if
{840} 0039:  0@ == 7
{847} 004D: jump_if_false @Noname_884
{854} 0007: 1@ = 2230.0
{864} 0007: 2@ = -1723.3
{874} 0007: 3@ = 13.55

:Noname_884
{884} 00D6: if
{888} 0039:  0@ == 8
{895} 004D: jump_if_false @Noname_932
{902} 0007: 1@ = 2290.33
{912} 0007: 2@ = -1724.68
{922} 0007: 3@ = 13.55

:Noname_932
{932} 00D6: if
{936} 0039:  0@ == 9
{943} 004D: jump_if_false @Noname_980
{950} 0007: 1@ = 1036.73
{960} 0007: 2@ = -1339.0
{970} 0007: 3@ = 13.73

:Noname_980
{980} 00D6: if
{984} 0039:  0@ == 10
{991} 004D: jump_if_false @Noname_1028
{998} 0007: 1@ = 1097.02
{1008} 0007: 2@ = -1271.6
{1018} 0007: 3@ = 13.54

:Noname_1028
{1028} 00D6: if
{1032} 0039:  0@ == 11
{1039} 004D: jump_if_false @Noname_1076
{1046} 0007: 1@ = 1045.27
{1056} 0007: 2@ = -1276.43
{1066} 0007: 3@ = 13.55

:Noname_1076
{1076} 00D6: if
{1080} 0039:  0@ == 12
{1087} 004D: jump_if_false @Noname_1124
{1094} 0007: 1@ = 926.75
{1104} 0007: 2@ = -1353.1
{1114} 0007: 3@ = 13.37

:Noname_1124
{1124} 00D6: if
{1128} 0039:  0@ == 13
{1135} 004D: jump_if_false @Noname_1172
{1142} 0007: 1@ = 496.69
{1152} 0007: 2@ = -1359.62
{1162} 0007: 3@ = 16.72

// ... ТУТ ЕЩЁ ПОЧТИ ДВЕ ТЫСЯЧИ СТРОК
Использование: 0AB1: call @getCoords 1 id 0@ to 1@ 2@ 3@, где 0@ - индекс элемента массива
Код:
CLEO:
:getCoords // 0@ is id
1@ = @coords
0@ *= 20
0062: 1@ -= 0@
jump 1@

:coords
0AB2: ret 3 123.4 567.8 910.11
0AB2: ret 3 14.88 1024.0 768.0
0AB2: ret 3 0.1 2.3 4.5
0AB2: ret 3 22.8 133.7 4659.50
// ...
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,983
Описание: Функция позволяющая изменить название заданного окна. Чтобы получить текущее можно использовать функцию GetActiveWindow .
Использование: 0AB1: call_scm_func @SetWindowTextA 2 HWND 0@ Name 1@
Код:

CLEO:
:SetWindowTextA
0AA2: 25@ = load_library "User32.DLL"
0AA4: 26@ = get_proc_address "SetWindowTextA" library 25@
0AA7: call_function 26@ num_params 2 pop 0 1@ 0@ 27@ // 0@ - HWND | 1@ - lpString
0AA3: free_library 25@
0AB2: ret 0

Результат:

aq0yduEswcc.jpg
 

DarkP1xel

Сила воли наше всё.
BH Team
3,635
4,983
Описание: Функция создаёт окно в окне с указанным название, текстом и типом.
Использование: 0AB1: /* [SP/MP] */ call_scm_func @SCM_MessageBox params 4 | hWnd 0@ lpText 1@ lpCaption 2@ uType 3@ | _errorCode 31@ |
Код функции:

CLEO:
:SCM_MessageBox // 0AB1: /* [SP/MP] */ call_scm_func @SCM_MessageBox params 4 | hWnd 0@ lpText 1@ lpCaption 2@ uType 3@ | _errorCode 31@ |
0AA2: 25@ = load_library "User32.DLL"
0AA4: 26@ = get_proc_address "MessageBoxA" library 25@
0AA7: call_function 26@ num_params 4 pop FALSE | uType 3@ lpCaption 2@ lpText 1@ hWnd 0@ | _errorCode 27@ |
0AA3: free_library 25@
0AB2: RET 1 | _errorCode 27@ |

Пример:

CLEO:
{$CLEO}
0AC6: 0@ = label @lpText offset
0AC6: 1@ = label @lpCaption offset

WHILE TRUE
0001: WAIT FALSE
    IF 0ADC:   test_cheat "1"
    THEN
    0AB1: /* [SP/MP] */ call_scm_func @SCM_GetForegroundWindow params FALSE || HWND 2@ |
    0AB1: /* [SP/MP] */ call_scm_func @SCM_MessageBox params 4 | hWnd 2@ lpText 0@ lpCaption 1@ uType 0x00000000 | _errorCode 31@ |
    END
END

:SCM_GetForegroundWindow // 0AB1: /* [SP/MP] */ call_scm_func @SCM_GetForegroundWindow params FALSE || HWND 31@ |
0AA2: 25@ = load_library "User32.DLL"
0AA4: 26@ = get_proc_address "GetForegroundWindow" library 25@
0AA7: call_function 26@ num_params 0 pop FALSE || HWND 27@ |
0AA3: free_library 25@
0AB2: RET 1 | HWND 27@ |

:SCM_MessageBox // 0AB1: /* [SP/MP] */ call_scm_func @SCM_MessageBox params 4 | hWnd 0@ lpText 1@ lpCaption 2@ uType 3@ | _errorCode 31@ |
0AA2: 25@ = load_library "User32.DLL"
0AA4: 26@ = get_proc_address "MessageBoxA" library 25@
0AA7: call_function 26@ num_params 4 pop FALSE | uType 3@ lpCaption 2@ lpText 1@ hWnd 0@ | _errorCode 27@ |
0AA3: free_library 25@
0AB2: RET 1 | _errorCode 27@ |

:lpText
HEX
    "MessageBox через CLEO :)" 0
END

:lpCaption
HEX
    "iTz_XG4M3R #420" 0
END


Результат:

I0fopP0.png