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

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Форма:
[B]Описание:
Использование:
Код:[/B]
[code=cleo]<код>[/code]

ФункцииИспользованиеОписание
getPlayerIdbyName0ab1: @getPlayerIdByName 1 nickname 0@ ID 1@Получает id игрока по нику
getScreenXYFrom3DCoords 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@ Переводит трехмерные координаты пространства в двумерные координаты экрана.
cmpString1andString2 0AB1: call @cmpString1andString2 2 1@ 2@Cравнивает две строки и возвращает результат сравнения: 0/1
[THEAD] [/THEAD]
[TBODY] [/TBODY]
 
Последнее редактирование:

spiceman

GOWNIK <3
104
34
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Описание: получает id игрока по ник-нейму.
Использование: 0ab1: @getPlayerIdByName 1 nickname 0@ id 1@
Код:
CLEO:
:getPlayerIdByName
for 1@ = 0 to 1000
    if SAMP.IsPlayerConnected(1@)
    then
        2@ = SAMP.GetPlayerNickname(1@)
        if 0C14: strcmp string1 0@ string2 2@
        then break
        end
    end
end
0ab2: 1 1@
Пример:
CLEO:
{$CLEO}
0000:
 
if 0@ = SAMP.Base()
then
    while not SAMP.Available()
        wait 500
    end
    0B34: samp register_client_command "getid" to_label @cmd
else end_thread
end
 
while true
    wait 0
end
 
:cmd
0B35: samp 0@ = get_last_command_params
0C17: 1@ = strlen 0@
if not 1@ == 0
then
    0ab1: @get_playerid_by_name 1 0@ 1@
    SAMP.AddChatMessage(" *PlayerID: %d", 0xFFFFFF, 1@)
else SAMP.AddChatMessage(" *Используйте: /getid [nickname]", 0xFFFFFF)
end
0B43: samp cmd_ret
 
:getPlayerIdByName
for 1@ = 0 to 1000
    if SAMP.IsPlayerConnected(1@)
    then
        2@ = SAMP.GetPlayerNickname(1@)
        if 0C14: strcmp string1 0@ string2 2@
        then break
        end
    end
end
0ab2: 1 1@
 
Последнее редактирование модератором:

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: сравнивает две строки и возвращает результат сравнения: 0/1
Использование: (как условие) 0AB1: call @cmpString1andString2 2 1@ 2@
Код:
Код:
:cmpString1andString2
{
    Example: 0AB1: call @cmpString1andString2 2 1@ 2@
    In: 0@, 1@ - strings
    Out: result 0/1
}
    for 7@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0    
    0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    0@ += 1
    1@ += 1
    if 003B: 2@ == 3@
    jf break
    if and
    2@ == 0
    3@ == 0
    then 
        0485: return_true
  ret 0 
    end
    end
059A: return_false
ret 0

Пример:
Код:
{$CLEO .cs}
wait 0
 
:load_samp_base
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
    wait 100
end
 
while true
wait 0
    0AC8: 1@ = 32
    0AC8: 2@ = 32
    if 0AB0: 49
    then
        0AD3: string 1@ format "Вышел немец из тумана"
        0AD3: string 2@ format "Пум пурум пум пум"
        if 0AB1: call @cmpString1andString2 2 1@ 2@
        then 0AF8: samp add_message_to_chat "Совпало" color 0x00FF00
        else 0AF8: samp add_message_to_chat "Не совпало" color 0xFF0000
        end
    else if 0AB0: 50
    then
        0AD3: string 1@ format "Вышел немец из тумана"
        0AD3: string 2@ format "Вышел немец из тумана"
        if 0AB1: call @cmpString1andString2 2 1@ 2@
        then 0AF8: samp add_message_to_chat "Совпало" color 0x00FF00
        else 0AF8: samp add_message_to_chat "Не совпало" color 0xFF0000
        end
    end
    end
    0AC9: 1@
    0AC9: 2@
end
 
:cmpString1andString2
{
    Example: 0AB1: call @cmpString1andString2 2 1@ 2@
    In: 0@, 1@ - strings
    Out: result 0/1
}
    for 7@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0    
    0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    0@ += 1
    1@ += 1
    if 003B: 2@ == 3@
    jf break
    if and
    2@ == 0
    3@ == 0
    then 
        0485: return_true
   ret 0 
    end
    end
059A: return_false
ret 0
 
  • Нравится
Реакции: gcode

Dark_Knight

hehe te nandayo
Друг
3,733
1,625
Описание: Получение названия оружия с ида его.
Использование: 0AB1 call @get_weapon_name_by_id 1 id 0@ to 1@
Код:
:get_weapon_name_by_id
{
Params:
In: 0@ - WeaponID
Out: 1@ - weaponName
 
Example: call @get_weapon_name_by_id 1 id 0@ to 1@
}
0AC6: 1@ = label @weapons offset
0@ *= 19
005A: 1@ += 0@ // (int)
ret 1 1@
 
:weapons
hex
"Duke" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 0 }
"Brass Knuckles" 00 00 00 00 00 { 1 }
"Golf Club" 00 00 00 00 00 00 00 00 00 00 { 2 }
"Nite Stick" 00 00 00 00 00 00 00 00 00 { 3 }
"Knife" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 4 }
"Baseball" 00 00 00 00 00 00 00 00 00 00 00 { 5 }
"Shovel" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 6 }
"Pool Cue" 00 00 00 00 00 00 00 00 00 00 00 { 7 }
"Katana" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 8 }
"Chainsaw" 00 00 00 00 00 00 00 00 00 00 00 { 9 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 10 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 11 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 12 }
"Dildo" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 13 }
"Flowers" 00 00 00 00 00 00 00 00 00 00 00 00 { 14 }
"Cane" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 15 }
"Grenade" 00 00 00 00 00 00 00 00 00 00 00 00 { 16 }
"Tear Gas" 00 00 00 00 00 00 00 00 00 00 00 { 17 }
"Molotov" 00 00 00 00 00 00 00 00 00 00 00 00 { 18 }
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 19 }
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 20 }
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 21 }
"Pistol" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 22 }
"Silencer" 00 00 00 00 00 00 00 00 00 00 00 { 23 }
"Deagle" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 24 }
"Shotgun" 00 00 00 00 00 00 00 00 00 00 00 00 { 25 }
"SawnOff" 00 00 00 00 00 00 00 00 00 00 00 00 { 26 }
"Spas12" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 27 }
"Tec9" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 28 }
"MP5" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 29 }
"AK47" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 30 }
"M4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 31 }
"Mac10" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 32 }
"Rifle" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 33 }
"Sniper" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 34 }
"Rocket Launcher" 00 00 00 00 { 35 }
"HS Rocket Launcher" 00 { 36 }
"Flamethrower" 00 00 00 00 00 00 00 { 37 }
"Minigun" 00 00 00 00 00 00 00 00 00 00 00 00 { 38 }
"C4" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 39 }
"Detonator" 00 00 00 00 00 00 00 00 00 00 { 40 }
"Spray" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 { 41 }
"Fire Extinguisher" 00 00 { 42 }
"Camera" 00 00 00 00 00 00 00 00 00 00 00 00 00 { 43 }
"Nightvision" 00 00 00 00 00 00 00 00 { 44 }
"Infrared Vision" 00 00 00 00 { 45 }
"Parachute" 00 00 00 00 00 00 00 00 00 00 { 46 }
end
Пример:
Код:
0470: 0@ = actor $PLAYER_ACTOR current_weapon
call @get_weapon_name_by_id 1 id 0@ to 1@
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED400' 2@
0AA5: call 0x718600 2 pop 2 2@ 1@
033E: set_draw_text_position 360.0 240.0 GXT 'CRED400'
Описание: Перезапись GXT записей.
Использование:
Код:
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED400' 2@
0AA5: call 0x718600 2 pop 2 2@ "Damage"
Пример:
Код:
Const
PING = 1@
end
 
0AC8: PING = allocate_memory_size 64
0B2B: samp 23@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B2A: samp 23@ = get_player_ping 23@
0AD3: string PING format "Ping: %d" 23@
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED002' 2@ // Get gxt text address by gxt name
0AA5: call 0x718600 2 pop 2 2@ PING
033E: set_draw_text_position 360.0 240.0 GXT 'CRED002'
0AC9: PING
 

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: получение размера строки
Использование: 0AB1: call @strlen 1 string 1@ return: 3@
Код:
Код:
:strlen
{
    Example: 0AB1: call @strlen 1 string 1@ return: 3@
    In: 0@ - text;
    Out: 1@ - size;
}
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@
Пример:
Код:
{$CLEO .cs}
wait 0
 
:load_samp_base
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
    wait 100
end
 
while true
wait 0
    if 0ADC: "her"
    then
        0AC8: 1@ = 32
        0AD3: string 1@ format "Вышел немец из тумана"
        0AB1: call @strlen 1 1@ return: 2@
        0AF8: samp add_message_to_chat "String: %s Size: %d" color 0xFF61BB 1@ 2@
        0AC9: 1@
    end
end
 
:strlen
{
    Example: 0AB1: call @strlen 1 string 1@ return: 3@
    In: 0@ - text;
    Out: 1@ - size;
}
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@
 

MogAika

Известный
Друг
237
395
Код:
const
SAMP_DIALOG_CHAT = 0x212AC4
//Окно чата - элементы в нем всегда видны (Но нажимать можно только если открыть чат
SAMP_DIALOG_SCOREBOARD = 0x212AC8
//Таблица игроков, элементы видны на TAB 
SAMP_DIALOG_CLASSELECTOR = 0x212ACC
//Выбор скина/класса 
SAMP_DIALOG_CLIENTDIALOG = 0x212AD0
//Диалог, к которому мы все привыкли
SAMP_DIALOG_UNK = 0x212AD4
//Хз (мб выбор модели (фишка 0.3х)) 
end
 
//example
//0AB1: call_scm_func @CDXUTControl__SetVisible 2 0@ visible true
:CDXUTControl__SetVisible
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 1
2@ += 64
0A8D: 3@ = read_memory 2@ size 4 virtual_protect 1
0AA6: call_method 3@ struct 0@ num_params 1 pop 0 1@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTControl__SetEnabled 2 2@ visible true
:CDXUTControl__SetEnabled
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 1
2@ += 56
0A8D: 3@ = read_memory 2@ size 4 virtual_protect 1
0AA6: call_method 3@ struct 0@ num_params 1 pop 0 1@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTDialog__GetControl 3 struct 1@ samp_base 0@ id 0x44 to 2@
:CDXUTDialog__GetControl
0A8E: 3@ = 1@ + 0x971C0
0AA8: call_function_method 3@ struct 0@ num_params 1 pop 0 id 2@ to 4@
0AB2: ret 1 4@
 
//example
//0AB1: call_scm_func @CDXUTDialog__AddButton 8 struct 1@ samp_base 0@ id 0x44 text "Button" x 240 y 32 width 400 height 16
:CDXUTDialog__AddButton
0A8E: 20@ = 1@ + 0x0A0B20
0AA6: call_method 20@ struct 0@ 9 0 params 0 0 0 height 7@ width 6@ y 5@ x 4@ strText 3@ id 2@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTDialog__AddComboBox 7 struct 1@ samp_base 0@ id 0x44 x 240 y 32 width 400 height 16
:CDXUTDialog__AddComboBox
0A8E: 20@ = 1@ + 0x0A1260
0AA6: call_method 20@ struct 0@ 8 params 0 0 0 0 height 6@ width 5@ y 4@ x 3@ id 2@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTDialog__AddCheckBox 9 struct 1@ samp_base 0@ id 0x44 textpointer 10@ x 240 y 32 width 400 height 16 checked 1
:CDXUTDialog__AddCheckBox
0A8E: 20@ = 1@ + 0x0A0BC0
0AA6: call_method 20@ struct 0@ 10 0 0 0 0 checked 8@ height 7@ width 6@ y 5@ x 4@ text 3@ id 2@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTComboBox__AddItem 4 struct 0@ samp_base 1@ textpointer 2@ datapointer 3@
:CDXUTComboBox__AddItem
0A8E: 10@ = 1@ + 0x9A5C0
0AA6: call_method 10@ struct 0@ num_params 2 pop 0 3@ 2@
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTControl__UpdateRects 2 struct 1@ samp_base 0@
:CDXUTControl__UpdateRects
0A8E: 3@ = 1@ + 0x94DA0
0AA6: call_method 3@ struct 0@ num_params 0 pop 0
0AB2: ret 0
 
//example
//0AB1: call_scm_func @CDXUTCheckBox__UpdateRects 2 struct 1@ samp_base 0@
:CDXUTCheckBox__UpdateRects
0A8E: 3@ = 1@ + 0x95090
0AA6: call_method 3@ struct 0@ num_params 0 pop 0
0AB2: ret 0
Пример:
Код:
0AA2: 31@ = load_library "kernel32.dll" // IF and SET
0AA4: 30@ = get_proc_address "GetModuleHandleA" library 31@ // IF and SET
0AA7: call_function 30@ num_params 1 pop 0 "samp.dll" 0@
0A8E: 1@ = 0@ + SAMP_DIALOG_CHAT
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1
0AC6: 10@ = label @string offset
0AB1: call_scm_func @CDXUTDialog__AddButton 8 struct 2@ samp_base 0@ id 0x44 text 10@ x 240 y 32 width 400 height 16
0AB1: call_scm_func @CDXUTDialog__AddCheckBox 9 struct 2@ samp_base 0@ id 0x43 textpointer 10@ x 240 y 32 width 400 height 16 checked 1
0AB1: call_scm_func @CDXUTDialog__AddCheckBox 9 struct 2@ samp_base 0@ id 0x42 textpointer 10@ x 240 y 56 width 400 height 16 checked 1
0AB1: call_scm_func @CDXUTDialog__AddCheckBox 9 struct 2@ samp_base 0@ id 0x41 textpointer 10@ x 240 y 80 width 400 height 16 checked 1
0A93: end_custom_thread
:string
hex
"STRING" 00
end
Создает кнопку и три чекбокса в окне чата
 
  • Нравится
Реакции: Lesorub

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: показывает текущий текст текстдрава сервера
Использование: 0AB1: call @getText 2 0@ 28@ return: 27@
Код:
Код:
: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@
Пример:
Код:
:load_samp_base
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
    wait 100
end

0B34: samp register_client_command "getText" to_label @Test

while true
wait 0
   
end

:Test
0B35: samp 30@ = get_last_command_params
if 0AD4: 29@ = scan_string 30@ format "%d" 28@
then
    if 29@ == 1
    then
        0AB1: call @getText 2 0@ 28@ return: 27@
        0AF8: samp add_message_to_chat "TextDraw ID: %d Text: %s" color 0xFF61BB 28@ 27@
    end   
end
cmd_ret

: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@
 
  • Нравится
Реакции: kraft1k и itsLegend

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: возвращает структуру пикапа
Использование: 0AB1: call @getPickUpStructure 2 0@ 28@ return: 23@ 24@ 25@ 26@ 27@
Код:
Код:
:getPickUpStructure
//
//    Example: 0AB1: call @getPickUpStructure 2 0@ 28@ return: 23@ 24@ 25@ 26@ 27@
//    In: 0@ - SAMP BASE; 1@ - PickUp ID;
//    Out: 4@ - model; 5@ - type; 6@,7@,8@ - X Y Z pos;
//
    0085: 2@ = 0@ // (int)
    2@ += 0x212A38
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x3D3
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x1BF08
    2@ += 0x7000
    3@ = 20
    006A: 3@ *= 1@
    005A: 2@ += 3@
    0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0  //model
    2@ += 4
    0A8D: 5@ = read_memory 2@ size 4 virtual_protect 0  //type
    2@ += 4
    0A8D: 6@ = read_memory 2@ size 4 virtual_protect 0  //X
    2@ += 4
    0A8D: 7@ = read_memory 2@ size 4 virtual_protect 0  //Y
    2@ += 4
    0A8D: 8@ = read_memory 2@ size 4 virtual_protect 0  //Z
0AB2: ret 5 4@ 5@ 6@ 7@ 8@
Пример:
Код:
{$CLEO .cs}
wait 0

:load_samp_base
if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end
while not SAMP.Available()
    wait 100
end

0B34: samp register_client_command "pickupinfo" to_label @Test

while true
wait 0
 
end

:Test
0B35: samp 30@ = get_last_command_params
if 0AD4: 29@ = scan_string 30@ format "%d" 28@
then
    if 29@ == 1
    then
        0AB1: call @getPickUpStructure 2 0@ 28@ return: 23@ 24@ 25@ 26@ 27@
        0AF8: samp add_message_to_chat "PickUp: %d Model: %d Type: %d Position: %.2f %.2f %.2f" color 0xFF61BB 28@ 23@ 24@ 25@ 26@ 27@
    end 
end
cmd_ret

:getPickUpStructure
//
//    Example: 0AB1: call @getPickUpStructure 2 0@ 28@ return: 23@ 24@ 25@ 26@ 27@
//    In: 0@ - SAMP BASE; 1@ - PickUp ID;
//    Out: 4@ - model; 5@ - type; 6@,7@,8@ - X Y Z pos;
//
    0085: 2@ = 0@ // (int)
    2@ += 0x212A38
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x3D3
    0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
    2@ += 0x1BF08
    2@ += 0x7000
    3@ = 20
    006A: 3@ *= 1@
    005A: 2@ += 3@
    0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0  //model
    2@ += 4
    0A8D: 5@ = read_memory 2@ size 4 virtual_protect 0  //type
    2@ += 4
    0A8D: 6@ = read_memory 2@ size 4 virtual_protect 0  //X
    2@ += 4
    0A8D: 7@ = read_memory 2@ size 4 virtual_protect 0  //Y
    2@ += 4
    0A8D: 8@ = read_memory 2@ size 4 virtual_protect 0  //Z
0AB2: ret 5 4@ 5@ 6@ 7@ 8@
 
Последнее редактирование модератором:

Dark_Knight

hehe te nandayo
Друг
3,733
1,625
Описание: получает цвет ника игрока в палитре RGB
Использование: 0AB1: call @get_player_color 1 id 0@ to 1@ 2@ 3@
Код:
Код:
:get_player_color
{
Params:
In: 0@ - playerID
Out: 1@, 2@, 3@ - RGB Player Color
}
0AF7: get_samp_base_to 3@ // IF and SET
3@ += 0x1FA348// SAMP_COLOR_OFFSET
0@ *= 4
005A: 3@ += 0@ // (int)
3@ += 3
0A8D: 1@ = read_memory 3@ size 1 virtual_protect 1 // Red
3@ -= 1
0A8D: 2@ = read_memory 3@ size 1 virtual_protect 1 // Green
3@ -= 1
0A8D: 3@ = read_memory 3@ size 1 virtual_protect 1 // Blue
0AB2: ret 3 1@ 2@ 3@
Пример:
Код:
{$CLEO}

if
not 29@ = samp.Base()
then
end_thread
end

repeat
wait 400
until samp.Available()

call @CheckDirectory 0
call @CheckFile 0

03F0: enable_text_draw 1

while true
wait 0
0@ = samp.GetSAMPPlayerIDByActorHandle($player_actor)
call @get_player_color 1 0@ 1@ 2@ 3@
call @getDrawBoxSetting 0 4@ 5@ 6@ 7@ 8@
038E: draw_box_position 4@ 5@ size 6@ 7@ RGBA 1@ 2@ 3@ 8@
end

:get_player_color
{
Params:
In: 0@ - playerID
Out: 1@, 2@, 3@ - RGB Player Color

Example: call @get_player_color 1 id 0@ to 1@ 2@ 3@
}
0AF7: get_samp_base_to 3@ // IF and SET
3@ += 0x1FA348// SAMP_COLOR_OFFSET
0@ *= 4
005A: 3@ += 0@ // (int)
3@ += 3
0A8D: 1@ = read_memory 3@ size 1 virtual_protect 1 // Red
3@ -= 1
0A8D: 2@ = read_memory 3@ size 1 virtual_protect 1 // Green
3@ -= 1
0A8D: 3@ = read_memory 3@ size 1 virtual_protect 1 // Blue
0AB2: ret 3 1@ 2@ 3@

:getDrawBoxSetting
0AF2: 0@ = get_float_from_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "PositionX"
0AF2: 1@ = get_float_from_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "PositionY"
0AF2: 2@ = get_float_from_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "SizeX"
0AF2: 3@ = get_float_from_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "SizeY"
0AF0: 4@ = get_int_from_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "Transparency"
ret 5 0@ 1@ 2@ 3@ 4@

:CheckDirectory
if
8AE4: directory_exist "Cleo\ini"
then
0AE5: create_directory "Cleo\ini"
end
ret 0

:CheckFile
if
8AAB: file_exists "cleo\ini\PlayerColor.ini"
then
file.Open(0@, "cleo\ini\PlayerColor.ini", "at")
0AF3: write_float 580.0 to_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "PositionX"
0AF3: write_float 360.0 to_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "PositionY"
0AF3: write_float 16.0 to_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "SizeX"
0AF3: write_float 16.0 to_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "SizeY"
0AF1: write_int 255 to_ini_file "cleo\ini\PlayerColor.ini" section "DrawBox" key "Transparency"
file.close(0@)
end
ret 0
 
  • Нравится
Реакции: kennex

FYP

🙁
Администратор
1,726
4,740
CLEO:
var
0@ : float
1@ : float
2@ : float
3@ : float
4@ : float
5@ : float
6@ : float
7@ : float
8@ : float
end

:scfpaawo
:store_coords_from_point_and_angle_with_offset
//
// 0AB1: @scfpaawo 7 point 0@ 1@ 2@ angle 3@ offsets 10.0 10.0 0.0 store_to 7@ 8@ 9@
//
//3@ *= -1.0
02F7: 7@ = cosine 3@ // (float)
02F6: 8@ = sine 3@ // (float)
7@ *= 4@
8@ *= 4@
0@ += 7@ // (float)
1@ += 8@ // (float)
3@ *= -1.0
02F6: 7@ = sine 3@ // (float)
02F7: 8@ = cosine 3@ // (float)
7@ *= 5@
8@ *= 5@
0@ += 7@ // (float)
1@ += 8@ // (float)
2@ += 6@
0AB2: ret 3 0@ 1@ 2@
Код:
:store_camera_angle
//
// 0AB1: @store_camera_angle 0 angle_to 7@
//
068D: get_camera_position_to 2@ 3@ 4@
068E: get_camera_target_point_to 5@ 6@ 7@
0063: 5@ -= 2@ // (float)
0063: 6@ -= 3@ // (float)
0604: get_Z_angle_for_point 5@ 6@ store_to 7@
0AB2: ret 1 7@
Код:
:readStringFromList
// call @readStringFromList 2 list @patcheslist string_number 1@ to 3@
var
1@ : int
2@ : int
end

0AC6: 0@ = label 0@ offset
0@ += 4
2@ = 0
while 2@ < 1@
    3@ = 1
    while 3@ <> 0
        0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0
        inc(0@)
    end
    0@ += 3
    inc(2@)
end

ret 1 0@
Пример:
Код:
{$CLEO}

wait 0

if not 0@ = samp.Base()
then 0a93:
end
while not samp.Available()
wait 100
end
0AC8: 0@ = allocate_memory_size 260
0AC8: 5@ = allocate_memory_size 260
10@ = 0
while true
    wait 0
    if key_pressed 0x31
    then
        call @readStringFromList 2 list @patcheslist string_number 0 to 3@
        0AD3: string 0@ format "%s" 3@
        for 1@ = 1 to 3
            call @readStringFromList 2 list @patcheslist string_number 1@ to 3@
            0AD3: string 5@ format "%s%c%cFF0000%c%s" 0@ 10 0x7B 0x7D 3@
            0AD3: string 0@ format "%s" 5@
        end
        0B3B: samp show_dialog id 2 caption "Example" text 5@ button_1 "Ok" button_2 "" style 2
        wait 1000
        10@ += 1
    end
end

:patcheslist
0900: "Watafak"
0900: "OMFG"
0900: "Dafuq"
0900: "Trololo"
0000:
Примечание: необходимо использовать в цикле с нулевой задержкой.
Код:
const
TIMER_OFFSET = 0xB7CB84
end

:FPS
// in: 0@ - frameCounter, 1@, 2@, 3@, 4@ - fpsBuf, 5@ - fpsTime, 6@ - fpsDisplay. out: 0@ - frameCounter, 1@, 2@, 3@, 4@ - fpsBuf, 5@ - fpsTime, 6@ - fpsDisplay
0@ += 1.0 // fpsFrameCounter++;
0A8D: 7@ = read_memory TIMER_OFFSET size 4 virtual_protect 0 // GetTickCount
0085: 8@ = 7@ // (int)
0062: 7@ -= 5@ // (int)
if 7@ > 240 // if ( (GetTickCount() - 240) > fps_time )
then
0087: 4@ = 3@ // fpsBuf4 = fpsBuf3;
0087: 3@ = 2@ // fpsBuf3 = fpsBuf2;
0087: 2@ = 1@ // fpsBuf2 = fpsBuf1;

// fpsBuf1 = ( fpsFrameCounter * 4 );
0087: 1@ = 0@
1@ *= 4.0

// fpsDisplay = ( fpsBuf1 + fpsBuf2 + fpsBuf3 + fpsBuf4 ) / 4.0;
0087: 6@ = 1@
005B: 6@ += 2@ // (float)
005B: 6@ += 3@ // (float)
005B: 6@ += 4@ // (float)
6@ /= 4.0

// fpsFrameCounter = 0;
0@ = 0.0

// fps_time = GetTickCount();
0085: 5@ = 8@
end
ret 7 0@ 1@ 2@ 3@ 4@ 5@ 6@
Пример:
Код:
03F0: enable_text_draw 1
0@ = 0.0
1@ = 0.0
2@ = 0.0
3@ = 0.0
4@ = 0.0
5@ = 0
6@ = 0.0

while true

    wait 0
    if player.Defined(0)
    jf continue
 
    call @FPS 7 in 0@ 1@ 2@ 3@ 4@ 5@ 6@ out 0@ 1@ 2@ 3@ 4@ 5@ 6@
    0092: 8@ = float 6@ to_integer
    045A: draw_text_1number 85.0 425.0 GXT 'NUMBER' number 8@
 
end
Код:
:cheat_actor_teleport
0A96: 4@ = actor 0@ struct
4@ += 20
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
4@ += 48 // X
0A8C: write_memory 4@ size 4 value 1@ virtual_protect 0 // X
4@ += 4 // Y
0A8C: write_memory 4@ size 4 value 2@ virtual_protect 0 // Y
4@ += 4 // Z
0A8C: write_memory 4@ size 4 value 3@ virtual_protect 0 // Z
ret 0
 
Последнее редактирование:

MogAika

Известный
Друг
237
395
Код:
//0AB1: @asm_call_hook 3 offset 1@ function 2@ virtual_protect 1
:asm_call_hook
0A8C: write_memory 0@ size 1 value 0xE8 virtual_protect 2@
0062: 1@ -= 0@ // (int)
000E: 1@ -= 5
0@ += 1
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 2@
0AB2: ret 0
Код:
//0AB1: @asm_call_hook_module 4 module 0@ offset 1@ function 2@ virtual_protect 1
:asm_call_hook_module
005A: 1@ += 0@ // (int) 
0A8C: write_memory 1@ size 1 value 0xE8 virtual_protect 3@
0062: 2@ -= 1@ // (int)
000E: 2@ -= 5
1@ += 1
0A8C: write_memory 1@ size 4 value 2@ virtual_protect 3@
0AB2: ret 0
Код:
//0AB1: @asm_jmp_hook 3 offset 1@ function 2@ virtual_protect 1
:asm_jmp_hook
0A8C: write_memory 0@ size 1 value 0xE9 virtual_protect 2@
0062: 1@ -= 0@ // (int)
000E: 1@ -= 5
0@ += 1
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 2@
0AB2: ret 0
Код:
//0AB1: @asm_jmp_hook_module 4 module 0@ offset 1@ function 2@ virtual_protect 1
:asm_jmp_hook_module
005A: 1@ += 0@ // (int) 
0A8C: write_memory 1@ size 1 value 0xE9 virtual_protect 3@
0062: 2@ -= 1@ // (int)
000E: 2@ -= 5
1@ += 1
0A8C: write_memory 1@ size 4 value 2@ virtual_protect 3@
0AB2: ret 0
 

Dark_Knight

hehe te nandayo
Друг
3,733
1,625
Функция получение системного времени компьютера
CLEO:
:GetSystemTime
/*
    Params:
        In: None
        Out: wYear 4@ wMonth 5@ wDayOfWeek 6@ wDay 7@ wHour 8@ wMinute 9@ wSeconds 10@ wMiliseconds 11@

    Example:
        0AB1: Call @GetLocalTime 0 wYear 4@ wMonth 5@ wDayOfWeek 6@ wDay 7@ wHour 8@ wMinute 9@ wSeconds 10@ wMiliseconds 11@
*/
0AA2: 0@ = load_library "kernel32.dll"
0AA4: 1@ = get_proc_address "GetSystemTime" library 0@
0AC8: 2@ = alloc mem 16
0AA5: call 1@ params 1 pop 0 2@
0085: 3@ = 2@

0A8D: 4@ = read mem 3@ size 2 vp 0 // wYear
3@ += 2

0A8D: 5@ = read mem 3@ size 2 vp 0 // wMonth
3@ += 2

0A8D: 6@ = read mem 3@ size 2 vp 0 // wDayOfWeek
3@ += 2

0A8D: 7@ = read mem 3@ size 2 vp 0 // wDay
3@ += 2

0A8D: 8@ = read mem 3@ size 2 vp 0 // wHour
3@ += 2

0A8D: 9@ = read mem 3@ size 2 vp 0 // wMinute
3@ += 2

0A8D: 10@ = read mem 3@ size 2 vp 0 // wSecond
3@ += 2

0A8D: 11@ = read mem 3@ size 2 vp 0 // wMilliseconds

0AC9: free_allocated_memory 2@
ret 8 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@
Функция получение локального времени компьютера
CLEO:
:GetLocalTime
/*
    Params:
        In: None
        Out: wYear 4@ wMonth 5@ wDayOfWeek 6@ wDay 7@ wHour 8@ wMinute 9@ wSeconds 10@ wMiliseconds 11@

    Example:
        0AB1: Call @GetLocalTime 0 wYear 4@ wMonth 5@ wDayOfWeek 6@ wDay 7@ wHour 8@ wMinute 9@ wSeconds 10@ wMiliseconds 11@
*/
0AA2: 0@ = load_library "kernel32.dll"
0AA4: 1@ = get_proc_address "GetLocalTime" library 0@
0AC8: 2@ = alloc mem 16
0AA5: call 1@ params 1 pop 0 2@
0085: 3@ = 2@

0A8D: 4@ = read mem 3@ size 2 vp 0 // wYear
3@ += 2

0A8D: 5@ = read mem 3@ size 2 vp 0 // wMonth
3@ += 2

0A8D: 6@ = read mem 3@ size 2 vp 0 // wDayOfWeek
3@ += 2

0A8D: 7@ = read mem 3@ size 2 vp 0 // wDay
3@ += 2

0A8D: 8@ = read mem 3@ size 2 vp 0 // wHour
3@ += 2

0A8D: 9@ = read mem 3@ size 2 vp 0 // wMinute
3@ += 2

0A8D: 10@ = read mem 3@ size 2 vp 0 // wSecond
3@ += 2

0A8D: 11@ = read mem 3@ size 2 vp 0 // wMilliseconds

0AC9: free_allocated_memory 2@
ret 8 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@
 

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: копирует строку от символа до символа
Использование: call @copy_string 4 text 0@ start 0 end 9 to_buffer 1@
Код:
Код:
:copy_string
var
    1@: int
    2@: int
    4@: int
    5@: int
end
if 1@ < 0
then
    059A: return_false
    ret 0 
end
0C17: 5@ = strlen 0@
if 2@ > 5@
then
    2@ = 5@
end
if 5@ <= 0
then
    059A: return_false
    ret 0
end
if 2@ < 1@
then
    059A: return_false
    ret 0
end
if 1@ >= 1
then
    for 4@ = 0 to 1@
    inc(0@)
    end
end
2@ -= 1@
inc(2@)
0C10: memcpy destination 3@ source 0@ size 2@
0485: return_true
ret 0
 
  • Нравится
Реакции: BUSHIDO32, gcode и Z0DY

MISTER_GONWIK

Всефорумный гонщик
Автор темы
Всефорумный модератор
1,213
1,507
Описание: ищет нужное вам слово в строке и возвращает результат (работает как условие)
Использование: call @search_text_in_the_text 2 0@ 1@ // 0@ - текст, 1@ - слово
Код:
Код:
:search_text_in_the_text
var 
    2@:int
    3@:int
    4@:int
    5@:int
    7@:int
    8@:int
end
7@ = 0
0C17: 4@ = strlen 0@
0C17: 8@ = strlen 1@
if or 
8@ > 4@
8@ <= 0
then
    059A: return_false
    ret 0
end
0AC8: 6@ = 1024
0C11: memset destination 6@ value 0 size 1024
0C10: memcpy destination 6@ source 1@ size 8@
for 5@ = 0 to 4@
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0
    if 2@ == 3@
    then 
        inc(1@)
        inc(7@)
    else
        7@ = 0 
        0C10: memcpy destination 1@ source 6@ size 8@    
    end
    if 7@ == 8@
    then
        0485: return_true
        ret 0    
    end
inc(0@) 
end
059A: return_false
0AC9: 6@
ret 0
 

alfazlo

Потрачен
128
35
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Описание: Рассчитывает кватернион(quaternion) из матрицы.
Использование: 0AB1: call_scm_func @Quaternion_get 1 matrix_pointer 0@ Quat_w 1@ Quat_x 2@ Quat_y 3@ Quat_z 4@
Код:
CLEO:
:Quaternion_get
wait 0
{
0A96: @ = actor $PLAYER_ACTOR struct
0A97: @ = car @ struct
0A98: @ = object @ struct
0C0C: @ = struct @ offset 20 size 4 //matrix pointer
0AB1: call_scm_func @Quaternion_get 1 matrix_pointer @ Quat_x @ Quat_y @ Quat_z @ Quat_w @
}
0C0C: 1@ = struct 0@ offset 0 size 4
0C0C: 2@ = struct 0@ offset 4 size 4
0C0C: 3@ = struct 0@ offset 8 size 4
0C0C: 4@ = struct 0@ offset 16 size 4
0C0C: 5@ = struct 0@ offset 20 size 4
0C0C: 6@ = struct 0@ offset 24 size 4
0C0C: 7@ = struct 0@ offset 32 size 4
0C0C: 8@ = struct 0@ offset 36 size 4
0C0C: 9@ = struct 0@ offset 40 size 4

005B: 10@ = 1@
005B: 10@ += 5@
005B: 10@ += 9@

if 0021: 10@ > 0.0
then
0007: 0@ = 0.5
000B: 10@ += 1.0
01FB: sqrt 10@ store_to 10@
0073: 0@ /= 10@  //s
0007: 15@ = 0.25
0073: 15@ /= 0@ //w
005B: 16@ = 8@  //x
0063: 16@ -= 6@
006B: 16@ *= 0@
005B: 17@ = 3@  //y
0063: 17@ -= 7@
006B: 17@ *= 0@
005B: 18@ = 4@  //z
0063: 18@ -= 2@
006B: 18@ *= 0@
else if and
    0025: 1@ > 5@
    0025: 1@ > 9@
    then
    0007: 0@ = 2.0
    0007: 10@ = 1.0
    005B: 10@ += 1@
    0063: 10@ -= 5@
    0063: 10@ -= 9@
    01FB: sqrt 10@ store_to 10@
    006B: 0@ *= 10@ //s
    005B: 15@ = 8@ //w
    0063: 15@ -= 6@
    0073: 15@ /= 0@
    0007: 16@ = 0.25 //x
    006B: 16@ *= 0@
    005B: 17@ = 2@
    005B: 17@ += 4@
    0073: 17@ /= 0@
    005B: 18@ = 3@
    005B: 18@ += 7@
    0073: 18@ /= 0@
    else if 0025: 5@ > 9@
          then
        0007: 0@ = 2.0
        0007: 10@ = 1.0
        005B: 10@ += 5@
        0063: 10@ -= 1@
        0063: 10@ -= 9@
        01FB: sqrt 10@ store_to 10@
        006B: 0@ *= 10@ //s
        005B: 15@ = 3@ //w
        0063: 15@ -= 7@
        0073: 15@ /= 0@
        005B: 16@ = 2@ //x
        005B: 16@ += 4@
        0073: 16@ /= 0@
        0007: 17@ = 0.25 //y
        006B: 17@ *= 0@
        005B: 18@ = 6@  //z
        005B: 18@ += 8@
        0073: 18@ /= 0@
          else
        0007: 0@ = 2.0
        0007: 10@ = 1.0
        005B: 10@ += 9@
        0063: 10@ -= 1@
        0063: 10@ -= 5@
        01FB: sqrt 10@ store_to 10@
        006B: 0@ *= 10@ //s
        005B: 15@ = 4@ //w
        0063: 15@ -= 2@
        0073: 15@ /= 0@
        005B: 16@ = 3@ //x
        005B: 16@ += 7@
        0073: 16@ /= 0@
        005B: 17@ = 6@  //y
        005B: 17@ += 8@
        0073: 17@ /= 0@
        0007: 18@ = 0.25 //z
        006B: 18@ *= 0@
        end
    end
end          
0AB2: ret 4 15@ 16@ 17@ 18@