Code:
INI File:
Command Typed:
The crash occurs only when the file reading part is there, when I comment that out it's fine (but of course without valid coordinates). How am I to properly read the coordinates from the file?
EDIT: The code above was just an example, here is the real code.
When I do "/savemark new" it crashes but actually writes a blank section and part of a value, but not what is expected. When I do "/marker test" it crashes with no sign of any thing working (the ini for this is above).
Code:
SAMP.IsCommandTyped(0@)
0AF2: 0@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posX"
0AF2: 1@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posY"
0AF2: 2@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posZ"
25@ = Marker.CreateIconAndSphere(56, 0@, 1@, 2@)
Code:
[test]
posX = 3000.0
posY = 3000.0
posZ = 3000.0
Code:
/mark test
EDIT: The code above was just an example, here is the real code.
Code:
{$CLEO .cs}
0000: NOP
REPEAT
WAIT 50
UNTIL SAMP.Available()
0B34: samp register_client_command "marker" to_label @CMD_MARKER
0B34: samp register_client_command "savemark" to_label @CMD_SAVEMARK
0B34: samp register_client_command "markpos" to_label @CMD_MARKPOS
08A8: set_markers_to_long_distance 1
:LOOP
WAIT 0
GOTO @LOOP
:CMD_MARKER
WAIT 0
SAMP.IsCommandTyped(0@)
IF
0AD4: 31@ = scan_string 0@ format "%s" 0@
THEN
0AF2: 1@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posX"
0AF2: 2@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posY"
0AF2: 3@ = get_float_from_ini_file "cleo\positions.ini" section 0@ key "posZ"
IF AND
1@ == 0.0
2@ == 0.0
3@ == 0.0
THEN
CHATMSG "ERROR: Invalid position name." -1
ELSE
Marker.Disable(25@)
25@ = Marker.CreateIconAndSphere(56, 0@, 1@, 2@)
CHATMSG "Marker position loaded." -1
018C: play_sound 1137 at 0.0 0.0 0.0
END
ELSE
CHATMSG "USAGE: /mark <place name from ini>" -1
END
SAMP.CmdRet
GOTO @LOOP
:CMD_SAVEMARK
WAIT 0
SAMP.IsCommandTyped(0@)
IF
0AD4: 31@ = scan_string 0@ format "%s" 0@
THEN
Actor.StorePos($Player_actor, 1@, 2@, 3@)
0AF3: write_float 1@ to_ini_file "cleo\positions.ini" section 0@ key "posX"
0AF3: write_float 2@ to_ini_file "cleo\positions.ini" section 0@ key "posY"
0AF3: write_float 3@ to_ini_file "cleo\positions.ini" section 0@ key "posZ"
CHATMSG "Marker position saved." -1
018C: play_sound 1137 at 0.0 0.0 0.0
ELSE
CHATMSG "USAGE: /savemark <place name to ini>" -1
END
SAMP.CmdRet
GOTO @LOOP
:CMD_MARKPOS
WAIT 0
Marker.Disable(26@)
Actor.StorePos($Player_actor, 1@, 2@, 3@)
26@ = Marker.CreateIconAndSphere(56, 1@, 2@, 3@)
CHATMSG "Position marked." -1
018C: play_sound 1137 at 0.0 0.0 0.0
SAMP.CmdRet
GOTO @LOOP