#1 02-08-2020 07:20

Bear
Registered: 02-08-2020
Posts: 1

Malfunctioning .cs file for displaying distance from checkpoint

I downloaded a mod for displaying the distance between the player and the checkpoint. I followed the instructions, put the .cs and .ini files inside CLEO but my game crashed every time right when I loaded a savegame or started a new game.

Mod: https://youtu.be/i5xmdaXV5Y4

Please point out any error in the script or guide me on how to make my own for achieving the mod.

// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 6.14.2013
{$CLEO .cs}

//-------------MAIN---------------
thread "distance" 
wait 2000 

:DISTANCE_17
wait 100 
0AAB:   file_exists "CLEO\cp_distance.ini" 
else_jump @DISTANCE_17 
0AF2: 3@ = get_float_from_ini_file "cleo\cp_distance.ini" section "Pos" key "PosX" 
0AF2: 4@ = get_float_from_ini_file "cleo\cp_distance.ini" section "Pos" key "PosY" 
0AC8: 11@ = allocate_memory_size 1024 

:DISTANCE_136
wait 0 
if 
0ADC:   test_cheat "RLDCP" 
else_jump @DISTANCE_236 
0AF2: 3@ = get_float_from_ini_file "cleo\cp_distance.ini" section "Pos" key "PosX" 
0AF2: 4@ = get_float_from_ini_file "cleo\cp_distance.ini" section "Pos" key "PosY" 

:DISTANCE_236
if 
0AB1: call_scm_func @DISTANCE_593 0 
else_jump @DISTANCE_459 
03F0: enable_text_draw 1 
0AB1: call_scm_func @DISTANCE_466 0 30@ 29@ 28@ 
Actor.StorePos($PLAYER_ACTOR, 27@, 26@, 25@)
050A: 16@ = distance_between_XYZ 27@ 26@ 25@ and_XYZ 30@ 29@ 28@ 
0092: 16@ = float 16@ to_integer 
0AD3: 11@ = format "Distance: %d" 16@ 
0AA8: call_function_method 6946896 struct 12694336 num_params 1 pop 0 'CRED209' 21@ 
0AA5: call 7439872 num_params 2 pop 2 21@ 11@ 
033F: set_text_draw_letter_size 0.33 1.2 
081C: draw_text_outline 1 RGBA 0 0 0 255 
0340: set_text_draw_RGBA 255 255 255 255 
0349: set_text_draw_font 3 
03E4: set_text_draw_align_right 1 
033E: set_draw_text_position 3@ 4@ GXT 'CRED209'  // Gary J. Foreman

:DISTANCE_459
jump @DISTANCE_136 

:DISTANCE_466
if 
0AA2: 0@ = load_library "samp.dll" // IF and SET 
else_jump @DISTANCE_579 
0A8E: 1@ = 0@ + 2203916 // int 
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 
1@ += 12 
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0 
1@ += 4 
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0 
1@ += 4 
0A8D: 4@ = read_memory 1@ size 4 virtual_protect 0 
0AA3: free_library 0@ 

:DISTANCE_579
0AB2: 3 2@ 3@ 4@ ret 

:DISTANCE_593
if 
0AA2: 0@ = load_library "samp.dll" // IF and SET 
else_jump @DISTANCE_697 
0A8E: 1@ = 0@ + 2203916 // int 
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 
1@ += 36 
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 
if 
  1@ == 1 
else_jump @DISTANCE_690 
0485:   return_true 
jump @DISTANCE_692 

:DISTANCE_690
059A:   return_false 

:DISTANCE_692
0AA3: free_library 0@ 

:DISTANCE_697
0AB2: 0 ret

Offline

Board footer

Powered by FluxBB