CLEO Help [HELP CLEO] Write to new line in ini file

CLEO related
Status
Not open for further replies.

Ayamabi

Active member
Joined
Mar 8, 2018
Messages
169
Reaction score
111
Hello, i wanted to create something like friend checker and i actually did something but i have problem writing to a new line in ini file here's my code


Code:
:{$CLEO}
0000:

alloc 0@ 100
0B6D: render 1@ = create_font "Arial" height 10 flags 0x1 

0B34: "fadd" @FriendAdd

while true
wait 0
if 2@ == true
then
SAMP.IsCommandTyped(2@)
if      
0AD4: 2@ = scan_string 2@ format "%d" 31@
if
SAMP.IsPlayerConnected(31@) 
then              
0B20: samp 3@ = actor_handle_by_samp_player_id 31@
0B36: samp 5@ = get_player_nickname 31@
if
0AAB: file_exists "CLEO\Friends.ini"
then    
0AF5: write_string 5@ to_ini_file "cleo\Friends.ini" section "FriendList" key "friend_" 
printf "Added %s" 1300 5@ 
else
printf "<<Friends Error>> Friends.ini not found!" 1300                                                                                                
end   
else
printf "<<Friends Error>> Player isn't connected!" 1300
end
end
end


:FriendAdd
0B12: 2@ = 2@ XOR 1
cmdret 

so code above will create friend_= "PLAYER NAME GET BY ID" in ini file but everytime when i type /fadd <id> it overwrites that line and deletes previous friend name but i want to add new friend name into new line

if someone can post little explanation here i'll be very grateful
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,500
Solutions
1
Reaction score
246
Location
( ͡° ͜ʖ ͡°)
Maybe this can help you?

if
8AAB: file_exists "CLEO\C\C-Console.log"
then
WHILE 8A9A: 30@ = openfile "CLEO\C\C-Console.log" mode "at" // IF and SET
wait 0
END
0AD9: write_formatted_text "~R~LOG:~g~ C-Console logger has been started1.%c" in_file 30@ 0xA
0A9B: closefile 30@
end
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,365
Solutions
7
Reaction score
972
Location
Lithuania
Opcode.eXe said:
Maybe this can help you?

if
8AAB:   file_exists "CLEO\C\C-Console.log"
then
   WHILE 8A9A: 30@ = openfile "CLEO\C\C-Console.log" mode "at"  // IF and SET
       wait 0
   END
   0AD9: write_formatted_text "~R~LOG:~g~ C-Console logger has been started1.%c" in_file 30@ 0xA
   0A9B: closefile 30@
end

What this opcode doing?
[shcode=cpp]
0xA
[/shcode]
 

Ayamabi

Active member
Joined
Mar 8, 2018
Messages
169
Reaction score
111
Parazitas said:
What this opcode doing?
[shcode=cpp]
0xA
[/shcode]

it puts new line into ini file you need to set like this 

0AD9: write_formatted_text "Cleo.%c" in_file 30@ 0xA,  %c is for 0xA and 0xA puts text in new line
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,365
Solutions
7
Reaction score
972
Location
Lithuania
Ayamabi said:
Parazitas said:
What this opcode doing?
[shcode=cpp]
0xA
[/shcode]

it puts new line into ini file you need to set like this 

0AD9: write_formatted_text "Cleo.%c" in_file 30@ 0xA,  %c is for 0xA and 0xA puts text in new line

Thanks for explane.
 
Status
Not open for further replies.
Top