Snippets

This section is only for CLEO Snippet threads. This section is mainly for posting snippets which users can use to develop their own cleo, for example "Draw line snippet". Do not post any releases, help, requests or tutorials&guides threads in this section. If you would like to release a new cleo, visit: >> https://ugbase.eu/releases-6/ If you need to ask for help or help other users about something to do with cleo, visit >> https://ugbase.eu/help-7/ If you would like to request or help to develop a cleo, visit: >> https://ugbase.eu/requests-10/ If you would like to post any Tutorials&Guides threads or learn new things about cleo, visit: >> https://ugbase.eu/tutorials/ Posting different threads which do not have anything to do with...
I want to know what a snippet clearly means. What does it stand for ? Can we use it ?
Computes the Vehicle's XYZ Rotation Velocity relative to its own X(Pitch), Y(Roll), and Z(Yaw) Axes. [/SPOILER] [/SPOILER] Computes the Vehicle's XYZ Rotation Velocity Relative to its own z(Roll) Axis. The Computation uses a Relative x(Pitch) Axis and Y(Roll) Axes pinned at 0.0 degrees. [/SPOILER] [/SPOILER] Computes the Vehicle's XYZ Rotation Velocity relative to the TrueNorth's Axis by NS, EW, and NW. [/SPOILER] [/SPOILER]
Based on this documentary, but this time I will demonstrate how we can register/Hook multiple new CMD and recover the parameters you've inputted in chat without using SAMPFUNCS Opcodes.
:get3DXYZInFrontOf{X,Y,Z,ZA,YA,Distance} {        Return:         PosX-InFrontOf         PosY-InFrontOf         PosZ-InFrontOf             Example: 0AB1: call_scm_func @get3DXYZInFrontOf 6 XYZ 1@ 2@ 3@ Z_Angle 4@ Y_Angle 5@  Distance 7.0 Return_XYZ_To 6@ 7@ 8@ } 3@ *= -1.0 02F6: 6@ = sine 3@ 006B: 6@ *= 5@ 005B: 0@ += 6@ 02F7: 6@ = cosine 3@ 006B: 6@ *= 5@ 005B: 1@ += 6@ 02F7: 6@ = cosine 4@ 0073: 5@ /= 6@ 02F6: 6@ = sine 4@ 006B: 5@ *= 6@ 005B: 2@ += 5@ 0AB2: ret 3 0@ 1@ 2@
With this snippet you can get digits from any text ! Explain.: {$CLEO} 0000: repeat wait 50 until 0AFA: is_samp_available 0AC8: 0@ = allocate_memory_size 260 0AD3: 0@ = format "aaa:12345678910" 0AC8: 1@ = allocate_memory_size 260 0AB1: call_scm_func @get_digits_to_print param_count 2 text 0@ memory_to_store_digits_as_text 1@ chatmsg 1@ -1 0A93: end_custom_thread :get_digits_to_print { 0@ = text 1@ = pointer to memory where digits will be stored as text } 0C17: 31@ = strlen 0@ for 30@ = 0 to 31@ 0085: 29@ = 0@ // copy pointer 005A: 29@ += 30@ // add offset (as the loop progresses it becomes pointers to first-last character) 0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the...
With this snippet we can create samp dialog. Good luck... Explain with 0.3.7 .: {$CLEO .cs} 0000: wait 8500 WHILE TRUE WAIT 0 IF 0AB0: 49 {Key 1} THEN 0AC8: 0@ = allocate_memory_size 260 0AC8: 1@ = allocate_memory_size 260 0AC8: 2@ = allocate_memory_size 260 0AC8: 3@ = allocate_memory_size 260 0AD3: 0@ = format "This is Dialog caption" 0AD3: 1@ = format "DialogText %cDialogText" 0xA // 0xA - NEW LINE 0AD3: 2@ = format "Ok" 0AD3: 3@ = format "Close" 0AB1: @ShowDialog 6 id 1000 caption 0@ text 1@ button_1 2@ button_2 3@ style 2 wait 300 END END :ShowDialog IF 0AA2: 10@ = "samp.dll" THEN 0A8E: 11@ = 10@ + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET 0A8D: 12@ = readMem 11@ sz 4 vp 1...
IF 0ADC: test_cheat "RO" THEN 0A92: create_custom_thread "MyScriptName.cs" 0AD1: show_formatted_text_highpriority "Reloading..." time 9999 0A93: end_custom_thread END Example
:sampSendClickTextdraw { 0.3.7 - R1 0BCA: @sampSendClickTextdraw 1 TextDrawID 0@ } if 0AA2: 2@ = "samp.dll" then 0085: 3@ = 2@ 3@ += 0x21A0CC 0A8D: 3@ = readMem 3@ sz 4 vp 1 0A8E: 4@ = 3@ + 8 0A8C: writeMem 4@ sz 4 value 0@ vp 0 0A8E: 5@ = 2@ + 0x6CEA0 0AA6: call 5@ struct 3@ num_params 0 pop 0 end 0AB2: 0 :sampSendClickTextdraw { 0.3.7 - R2 0BCA: @sampSendClickTextdraw 1 TextDrawID 0@ } if 0AA2: 2@ = "samp.dll" then 0085: 3@ = 2@ 3@ += 0x21A0D4 0A8D: 3@ = readMem 3@ sz 4 vp 1 0A8E: 4@ = 3@ + 8 0A8C: writeMem 4@ sz 4 value 0@ vp 0 0A8E: 5@ = 2@ + 0x6CF40 0AA6: call 5@ struct 3@ num_params 0 pop 0 end 0AB2: 0 :sampSendClickTextdraw { 0.3.7 - R3...
const SAMP_CHAT_INFO_OFFSET = 0x212A6C SAMP_CHAT_INFO_OFFSET_R2 = 0x212AA4 FUNC_ADDTOCHATWND = 0x7A4F0 FUNC_ADDTOCHATWND_R2 = 0x61AB0 FUNC_SAY = 0x4CA0 FUNC_SAY_R2 = 0x4C30 end 0AF9(SFUNCS) Sends a message in chat //0AB1: @SAY 1 $text :SAY IF 0AA2: 1@ = "samp.dll" THEN     1@ += FUNC_SAY     0AA5: call 1@ num_param 1 pop 0 0@ END 0AB2: 0 0AF8(SFUNCS) Add a message to chat(not synched) //0AB1: @addMsgToChatWnd 2 $color $text :addMsgToChatWnd IF 0AA2: 2@ = "samp.dll" THEN     0085: 3@ = 2@     3@ += SAMP_CHAT_INFO_OFFSET     0A8D: 3@ = readMem 3@ sz 4 vp 1     0085: 4@ = 2@     4@ += FUNC_ADDTOCHATWND        0AA6: call 4@ struct 3@ num_params 5 pop 0 params 0 0@ 0 1@ 8 END 0AB2: 0 Simple example;
:RotationSpeedAngleZ { Status 1 = true Status 0 = false 0AB1: @RotationSpeedAngleZ 1 Status 1 } 0A96: 1@ = ped $PLAYER_ACTOR struct 0A8E: 2@ = 1@ + 0x560 // CPed +0x560 = [float] Rotation speed (Z angle) IF 0@ == 1 THEN 0A8C: writeMem 2@ sz 4 val 30.0 vp 1 ELSE 0A8C: writeMem 2@ sz 4 val 7.5 vp 1 END 0AB2: 0 Example
:SendLagRate { Status 1 = true Status 0 = false 0AB1: @SendLagRate 2 SampVersionID 0@ Status 1 } IF 0AA2: 10@ = "samp.dll" THEN IF 0@ == 1 // 0.3.7 R1 THEN IF 1@ == 1 THEN 0A8E: 11@ = 10@ + 0xEC0A8 0A8D: 12@ = readMem 11@ sz 4 vp 0 0A8C: writeMem 11@ sz 4 val 500 vp 0 0A8E: 11@ = 10@ + 0xEC0AC 0A8D: 13@ = readMem 11@ sz 4 vp 0 0A8C: writeMem 11@ sz 4 val 500 vp 0 0A8E: 11@ = 10@ + 0xEC0B0 0A8D: 14@ = readMem 11@ sz 4 vp 0 0A8C: writeMem 11@ sz 4 val 500 vp 0 ELSE 0A8E: 11@ = 10@ + 0xEC0A8 0A8C: writeMem 11@ sz 4 val 12@ vp 0...
Checks if there's any checkpoint active, use as condition(if) //call @is_cp_active 0 Checks if there's any race checkpoint active, use as condition(if) //call @is_racecp_active 0 Gets checkpoint position(XYZ) //call @get_cp_pos 0 X 1@ Y 2@ Z 3@ Gets racecheckpoint position(XYZ) //call @get_racecp_pos 0 X 1@ Y 2@ Z 3@
Example {$CLEO .cs} 0000: NOP wait 10000 13@ = Render.CreateFont("Verdana", 8, 12) WHILE TRUE WAIT 0 if 0AB0: KEY_X 88 then 0A8D: 29@ = read_memory 0xB7449C size 4 virtual_protect 0 000A: 29@ += 0x4 0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0 for 30@ = 0 to 89344 step 0x100 0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0 000A: 29@ += 0x1 if and 0029: 31@ >= 0x00 001B: 0x80 > 31@ then 005A: 31@ += 30@ if and 03CA: object 31@ exists 02CC: object 31@ bounding_sphere_visible then 01BB: store_object 31@ position_to 1@ 2@ 3@ 0B55...
This is FPSUnlocker (From 0.3.7 R1 - 0.3.7 R3 + 0.3.DL - R1). You can use it on new cleo extension Cleo Redux: https://re.cleo.li/. Resource: /* FPSUnlocker for 0.3.7 - R1, 0.3.7 - R2, 0.3.DL - R1, 0.3.7 - R3 SAMP versions. FPSUnlocker function is reading the SAMP version from memory address + Library(samp.dll) which creates an address with which we can turn off the "NO_GAME_PAUSING" function which, as you assume, excludes the fps limit... Author: Fr0z3n - https://ugbase.eu/members/frozen.57428/ --------------------------------------------------------------- get_samp_version_id - https://ugbase.eu/threads/snippet-get-samp-version-js.22844/ */ // Pre-conf. /// <reference path=".config/sa.d.ts" /> ///...
This is snippet for getting samp versions(From 0.3.7 R1 - 0.3.7 R4 - 2). You can use it on new cleo extension Cleo Redux: https://re.cleo.li/. The code contains 2 functions: - get_samp_version_id - get_samp_version_name /* get_samp_version_id function is reading the "IMAGE_FILE_HEADER" of samp.dll (TimeDateStamp to be specific) That TimeDateStamp is based on compilation time. See this for more info: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#file-headers "TimeDateStamp = The low 32 bits of the number of seconds since 00:00 January 1, 1970 (a C run-time time_t value), that indicates when the file was created. " In most versions that time stamp is located at offset 0x128 from samp.dll. In...
This can be used to create scripts that work with various samp versions. In order to use it, I suggest to create "includes" folder inside the "gta_sa/cleo" folder. Then create "get_samp_version.txt" file inside it and paste the code below into it. The code below contains 2 functions: - get_samp_version_id (returning arbitrary number so you can easily compare it in your scripts) - get_samp_version_name /* get_samp_version_id function is reading the "IMAGE_FILE_HEADER" of samp.dll (TimeDateStamp to be specific) That TimeDateStamp is based on compilation time. See this for more info: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#file-headers "TimeDateStamp = The low 32 bits of the number of seconds...
This snippet returns how actor was damaged. Author: @ajom Some changes by: @Parazitas Snippet :isActorDamaged { Use: IF 0AB1: @isActorDamaged 1 ActorHandle: $PLAYER_ACTOR _Returned: DamagedBy 0@ } 0A96: 31@ = actor 0@ struct 0A8E: 30@ = 31@ + 0x760 // DamageID Offset 0A8D: 29@ = read_memory 30@ size 4 virtual_protect 0 IF NOT 29@ == 255 // 255 = not Damaged THEN 0085: 28@ = 29@ // (int) 0A8C: write_memory 30@ size 4 value 255 virtual_protect 0 // clear last damage 0485: return_true 0AB2: ret 1 28@ ELSE 059A: return_false END 0AB2: ret 0 List of Damage types ID's (Slot0: No Weapon) (Slot2: Handguns) 0 – Fist 22 – Pistol 1 – Brass Knuckles...
Top