Snippets

Function: 0AB1: @POSITION_TO_RADAR 7 XYZ 0.0 0.0 0.0 RADAR_POS 400 400 DISTANCE_MULTIPLIER 1.5 MAX_DISTANCE 300.0 _STORE_TO 1@ 2@ This function converts 3D position to 2D Radar position like on the Minimap. You can make things like this: http://i.san-mp.de/i/26CEA9.webm Source: {$CLEO .cs} 0000: REPEAT     WAIT 0 UNTIL 0AFA:  SAMP_IS_READY 0B6D: 5@ = create_font "Arial" height 10 flags 0x4 0BFC: SET_VAR "MadeByOpcodeXe" = 5@ WHILE TRUE     WAIT 0     FOR 31@ = 0 TO 1000         IF         0B23:  samp is_player_connected 31@         THEN             IF             0B20: samp 30@ = actor_handle_by_samp_player_id 31@             THEN                 0AB1: @GET_BONE_POS 2 FROM_ACTOR $PLAYER_ACTOR BONE 6 _STORE_TO 5@ 6@...
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 and getting synced invisible.
Example {$CLEO .cs} 0000: wait 8500 while true wait 0 if 0256: player $PLAYER_CHAR defined then for 0@ = 0 to 175 // from 0 to max blip 0AB1: @GetRadarBlipInfo 1 BlipID 0@ _Return: ColorID 1@ RGB 2@ 3@ 4@ XYZ 5@ 6@ 7@ IconID 8@ if 8@ == 0 // Square/Triangle - mostly used to mark checkpoint or any place in server by owner then if 00DF: actor $PLAYER_ACTOR driving then 03C0: 9@ = actor $PLAYER_ACTOR car 00AE: set_car 9@ traffic_behaviour_to 2 00A7: car 9@ drive_to 5@ 6@ 7@ end end end end end :GetRadarBlipInfo { 0AB1: @GetRadarBlipInfo 1 BlipID 0@ _Return: ColorID 1@ RGB 2@ 3@ 4@...
OPCODE: 0B47: samp close_current_dialog_with_button 1@ Without SAMPFUNCS :CLOSE_DIALOG { 0.3.7 - R3 0AB1: @CLOSE_DIALOG 1 Button 0 // 0 = Left , 1 = Right } IF 0AA2: 10@ = "samp.dll" THEN 0A8E: 11@ = 10@ + 0x26E898 // SAMP_DIALOG_INFO_OFFSET 0A8D: 12@ = readMem 11@ sz 4 vp 0 0A8E: 11@ = 10@ + 0x6FF40 //SAMP_DIALOG_CLOSE 0AA8: call_function_method 11@ struct 12@ num_params 1 pop 0 0@ $NOT_USED END 0AB2: 0 :CLOSE_DIALOG { 0.3.DL 0AB1: @CLOSE_DIALOG 1 Button 0 // 0 = Left , 1 = Right } IF 0AA2: 10@ = "samp.dll" THEN 0A8E: 11@ = 10@ + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET 0A8D: 12@ = readMem 11@ sz 4 vp 0 0A8E: 11@ = 10@ + 0x700D0 //SAMP_DIALOG_CLOSE 0AA8: call_function_method 11@...
const SAMP_CHAT_INFO_OFFSET = 0x212A6C //0.3z end :getChatEntryText // 0AB1: call @getChatEntryText 1 id 0@ to 1@ { In 0@ - number of chat line. 99 line is last. Out 1@ - line text } 0AB1: call @GetSampBase 0 1@ 1@ += SAMP_CHAT_INFO_OFFSET 0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 1@ += 0x136 0@ *= 252 // size of stChatEntry 005A: 1@ += 0@ // (int) 1@ += 28 0AB2: ret 1 1@ :GetSampBase 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@ 0ab2: ret 1 0@ 0.3.7 :getChatEntryText IF 0AA2: 1@ = "samp.dll" THEN     1@ += 0x21A0E4     0A8D: 1@ readMem 1@ sz 4 vp 0     1@ += 0x132     0@ *= 0xFC    ...
Example: if or 044B: actor $PLAYER_ACTOR on_foot 00DF: actor $PLAYER_ACTOR driving then 0AB1: @GetClosestPickup 0 XYZ 0@ 1@ 2@ 06D5: 29@ = create_racing_checkpoint_at 0@ 1@ 2@ point_to 0@ 1@ 2@ type 2 radius 1.0 wait 1000 06D6: disable_racing_checkpoint 29@ end 0AB1: @GetClosestPickup 0 XYZ 0@ 1@ 2@ :GetClosestPickup 20@ = 9999.0 for 30@ = 0x9788C0 to 0x97D620 step 0x20 if 30@ > 0 then 0A8E: 31@ = 30@ + 0x1A 0A8D: 31@ = read_memory 31@ size 2 virtual_protect 0 31@ *= 0x10000 0A8F: 29@ = 30@ - 0x9788C0 29@ /= 0x20 005A: 31@ += 29@ 065B: store_pickup 31@ position_to 4@ 5@ 6@ 04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR...
So.. you're making a CLEO and hate it to restart your Gta Sa all the time to test the new .cs? Well, here's the solution: 0AB1: @RESTART 1 WITH_KEY 88 // KEY_X Paste that function in the main loop of your cleo, now when u press X ingame, the new .cs gets loaded. ++ RENAME YOUR CLEO MOD TO: TEST.CS :RESTART IF 0AB0: 0@ THEN     REPEAT         WAIT 0         PRINT "~R~RESTART: ~w~TEST.CS" 100     UNTIL 8AB0: 0@ 0A92: RESTART "TEST.CS" 004E: STOP THIS CLEO END 0AB2: 0
100% - Working without SAMPFUNCS Example 0AD3: 0@ = format "Hello World" You wanna get "World" 0AB1: @GetLastCharacters 2 String 0@ Characters 5 rnt 1@ Snippet :GetLastCharacters { 0AB1: @GetLastCharacters 2 String 0@ Characters 5 rnt 1@ } 0AB1: @strlen 1 String 0@ Lenght 2@ 0062: 2@ -= 1@ 005A: 0@ += 2@ 0AB2: ret 1 0@ :strlen { Example: 0AB1: @strlen 1 string 1@ rtn 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@
Instead of using this shitty long function for an aimbot which was made by some russian: :AIM var 1@ :float 2@ :float 3@ :float 4@ :float 5@ :float 6@ :float 7@ :float 8@ :float 9@ :float 10@ :float 11@ :float 12@ :float 13@ :float 14@ :float 15@ :float end 0087: 4@ = 1@ // (float) 0087: 5@ = 2@ // (float) 0087: 6@ = 3@ // (float) 068D: get_camera_position_to 1@ 2@ 3@            //04C4: store_coords_to 4@ 5@ 6@ from_actor 0@ with_offset 7@ 8@ 9@ 04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 1@ -= 4@ 2@ -= 5@ 0096: make 1@ absolute_float 0096: make 2@ absolute_float 10@ = 1@ 11@ = 2@ 10@ *= 10@                                            11@ *= 11@ 10@ += 11@ 01FB: 10@ = square_root 10@ // Ac 11@ = 1@...
Function to take a simple samp screenshot. /*     call @TakeScreen 0 */ :TakeScreen IF 0AA2: 0@ = "samp.dll" THEN 0@ += 0x119CBC     0A8C: writeMem 0@ sz 1 val 1 vp 0 END /*   -SAMPFUNCS   0B2D: write_samp_memory offset 0x119CBC value 1 size 1 */ RET 0 Code snippet on how to get clean screenshots. {$CLEO} 0000: REPEAT     WAIT 0 UNTIL 0AA2: 0@ = "samp.dll" 0@ += 0x5D8C1 0A8C: writeMem 0@ sz 1 val 0 vp 1    //This disables taking screens with F8 /*   -SAMPFUNCS   0B2D: write_samp_memory offset 0x5D8C1 value 0 size 1 */ WHILE TRUE     WAIT 0     IF 0AB0: 119 //F8     THEN         /*             Disable mods before taking a screenshot             ex: call @EnableWallhack 1 FALSE         */         WAIT 1 //get clean frame         CALL...
Get surname from fullname Example: Black_Daddy Snippet return - Daddy 0AB1: @GetSurname 1 stringPointer 1@ Surname 3@ :GetSurname 0085: 28@ = 0@ // (int) 0085: 27@ = 0@ // (int) 29@ = 0 for 31@ = 0 to 200 0A8D: 30@ = read_memory 28@ size 1 virtual_protect 1 if 30@ == 0 then break else 28@++ 29@++ end if 31@ == 200 then //chatmsg "string seems to be over 200 chars" -1 end end for 31@ = 1 to 29@ 0A8D: 30@ = read_memory 0@ size 1 virtual_protect 1 if 30@ == 95 // if the character is "_" (ASCII table) then 0@++ //chatmsg 0@ -1 0AB2: ret 1 0@ else 0@++ end end 0AB2: ret 1 27@ 0AB1: @GetName 1 stringPointer 1@ // Self Return :GetName 0085: 27@ = 0@ // (int)...
With this snippet you can block Keyboard and mouse. Example {$CLEO .cs} 0000: wait 8500 while true wait 0 if and 0@ == false 044B: actor $PLAYER_ACTOR on_foot then 0AB1: @BlockInput 1 status 1 // 1 - block keyboard and mouse if 32@ > 30000 // if 30sec passed then... then 0@ = true 0AB1: @BlockInput 1 status 0 // 0 - turn off blocking. 32@ = 0 end end end :BlockInput 0AA2: 10@ = load_library "User32.DLL" 0AA4: 11@ = get_proc_address "BlockInput" library 10@ 0AA7: call_function 11@ num_params 1 pop 0 0@ 25@ 0AA3: free_library 10@ 0AB2: ret 0 Snippet 0AB1: @BlockInput 1 status 1 // 1 - block keyboard and mouse , 0 - turn off blocking :BlockInput 0AA2: 10@ = load_library...
{$CLEO} 0BE3: raknet setup_incoming_rpc_hook @iRPC 0BDE: 0 :iRPC 0BE5: raknet 0@ = get_hook_param 1 if or 0039:   0@ == 15 0039:   0@ == 157 0039:   0@ == 158 then 0BE0: raknet hook_ret 0 end 0BE0: raknet hook_ret 1 Undetectable and useful in events!
// FOR ALL PEDS    0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0 000A: 29@ += 0x4 0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0 for 30@ = 0 to 35584 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@         // GOT THE PED.     end end // FOR ALL PEDS END
You want to make a CarCheat but cant get Cars? Use this snippet: // FOR ALL CARS // ALL CARS WILL EXPLODE BY PRESSING X :X wait 0 if 0AB0: X jf x 0A8D: 29@ = read_memory 0xB74494 size 4 virtual_protect 0 29@ += 0x4 0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0 for 30@ = 0 to 27904 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@         // GOT THE CAR.       020B: explode_car 31@     end end // FOR ALLCARS END jump x
It's an alternative to this repeat wait 0 until 0AFA: is_samp_structures_available Based on: https://github.com/Garret22/DX9Hook-SAMP/blob/master/src/DX9Hook/dllmain.cpp This part exactly while (!g_Chat) { g_Chat = *(DWORD**)(g_dwSAMP_Addr + SAMP_CHAT_INFO_OFFSET); sleep(25); } Usage {$CLEO .cs} 0000: NOP 0AB1: call_scm_func @wait_for_samp_to_load 0 0AD1: show_formatted_text_highpriority "Samp was loaded." time 5000 0A93: end_custom_thread Functions to copy at the end of your script :wait_for_samp_to_load repeat wait 0 //0AD1: show_formatted_text_highpriority "loading samp" 5000 until 0AA2: 31@ = load_library "samp.dll" // IF and SET 0085: 30@ = 31@ // (int) 30@ += 0xBABE call @get_samp_version 1 addr_to_check 30@...
Strcat :strcat // 0@ - destination, 1@ - source // Example: 0AB1: @strcat 2 destination 0@ source 1@ 0AB1: @strlen 1 string 0@ _return: 2@ 0AB1: @strlen 1 string 1@ _return: 3@ 005A: 0@ += 2@ // (int) 0AB1: @memcpy 3 destination 0@ source 1@ size 3@ 005A: 0@ += 3@ // (int) 0AB1: @memset 3 destination 0@ value 0 size 1 0AB2: ret 0 :strlen { Example: 0AB1: @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@ Strncpy :strncpy var 0@ : integer 1@ : integer 2@ : integer 30@ : integer 31@ : integer end // 0@ - destination, 1@ - source, 2@ - size // Example: 0AB1: @strncpy 3...
Usage: alloc 2@ 100 format 2@ "CLEO/audio/*.mp3" call @load_file_names 2 max_filenames 1000 wildcard 2@ _name_array 0@ _index_of_highest_loaded_name 1@ for 31@ = 0 to 1@ call @get_nth_file_name 2 name_array 0@ n 31@ _returned_name 30@ chatmsg "%d. %s" -1 31@ 30@ end Functions to copy+paste somewhere at the end of your code: :get_nth_file_name { Input params: 0@ = pointer to array of pointers, each leading to filename 1@ = n (starting with 0) Usage: call @get_nth_file_name 2 name_array 0@ n 0 _returned_name 30@ } 1@ *= 4 // each pointer has 4 bytes 005A: 0@ += 1@ // (int) 0A8D: 31@ = read_memory 0@ size 4 virtual_protect 0 ret 1 31@ :load_file_names { Input params: 0@ = filenames limit 1@...
{ EXAMPLE:     if     0AB1: @GET_TARGET_CAR 0 _STORE_TO 0@     then         0186: 1@ = create_marker_above_car 0@         wait 500         0164: disable_marker 1@     end     by OpcodeXe }    :GET_TARGET_CAR 8@ = 0 {GOT_CAR?,FALSE} if 0AE2: 0@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 99999.0 find_next 0 pass_wrecked 0 then     REPEAT         if         00DF:  actor $PLAYER_ACTOR driving         then             03C0: 7@ = actor $PLAYER_ACTOR car             else             7@ = -1         end         0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 0.0 0.0         0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 1@ 2@ 3@ _to X 4@ Y 5@         03F0: enable_text_draw 1         //038E: draw_box_position 320.0 200.0 size...
Dialog Caption - 0.3.7 R3 0AB1: @GetDialogCaption 0 0@ :GetDialogCaption { 0.3.7 - R3 } 0AA2: 1@ = "samp.dll" 1@ += 0x26E898 0A8D: 1@ = readMem 1@ sz 4 vp 0 0A8E: 2@ = 1@ + 0x28 //DialogOpenOffset 0A8D: 2@ = readMem 2@ sz 4 vp 0 if 2@ == 1 // Dialog open then 0A8E: 3@ = 1@ + 0x40 //DialogCaptionOffset 0485: dialog_open 0AB2: ret 1 3@ else 059A: dialog closed end 0AB2: ret 0 Dialog Caption - 0.3.DL 0AB1: @GetDialogCaption 0 0@ :GetDialogCaption { 0.3.DL } 0AA2: 1@ = "samp.dll" 1@ += 0x2AC9E0 0A8D: 1@ = readMem 1@ sz 4 vp 0 0A8E: 2@ = 1@ + 0x28 //DialogOpenOffset 0A8D: 2@ = readMem 2@ sz 4 vp 0 if 2@ == 1 // Dialog open then 0A8E: 3@ = 1@ + 0x40 //DialogCaptionOffset 0485: dialog_open 0AB2...
:not_bad: Stolen from a russian website  :urtheman: :iknowwhatyoudid: :ppffh:
//0AB1: 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
For example you have text like: Please enter text /code 123 Snippet return: code 123 Snippet :GetStringAfterCharacter { 0AB1: @GetStringAfterCharacter 2 StringPointer 0@ Character 47 _Return 6@ // 47 = slash } 0C17: 31@ = strlen 0@ 31@ -= 1 for 30@ = 0 to 31@ 0A8D: 29@ = read_memory 0@ size 1 virtual_protect 1 if 003B: 29@ == 1@ // (int) then 0@++ 0AB2: 1 0@ end 0@++ end 0AB2: 0 Character id's http://www.asciitable.com/index/asciifull.gif
0AB1: @GetCharPos 2 string 0@ pos 1@ to 2@ :GetCharPos 0C17: 8@ = 0@ if 801D: 1@ > 8@ then 9@ = 0 while 001D: 1@ > 9@ inc(0@) 9@+=1 end 0C2D: strrev in 0@ out 0@ 0062: 8@ -= 1@ 9@ = 0 8@ -= 1 while 001D: 8@ > 9@ inc(0@) 9@+=1 end end ret 1 0@ By @WaTTi - 2017
100% - Working without SAMPFUNCS Example 0AD3: 0@ = format "xxString" You wanna cut "xx" 0AB1: @SkipFirstCharacters 2 String 0@ Characters 2 rnt 1@ Snippet :SkipFirstCharacters 005A: 0@ += 1@ 0AB2: ret 1 0@
Top