CLEO Help allocating memory to .ini

CLEO related
Status
Not open for further replies.

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
How can i alocate more memory to this?

SAMP.IsCommandTyped($test)

0AF5: write_string $test to_ini_file "cleo\test.ini" section "Section" key "string"

without crashing?

if i do not allocate memory to that write string, i have a restriction on when i read it, like

from a sentence like this : Hello guys, how is your day? 

On chat are like " Hello guy, ho "

thanks!
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
17
Location
Romania
@Rough ,

[shcode=cpp]      {$CLEO}

   :Noname_02
   WAIT 0 MS
   
   :Noname_03
   WAIT 0 MS
    IF 8AFA: NOT 
      THEN JUMP @Noname_03
   END
   
   0B63: "String"
   0B34: Create Command "String" To Shanker_Label @String
   
   :Noname_04
   WAIT 0 MS
   JUMP @Noname_04
   
   :String
   0AC8: $STRING_SHANKER = allocate_memory_size 260
   SAMP.IsCommandTyped($STRING_SHANKER)
   0AF5: write_string $STRING_SHANKER to_ini_file "cleo\Supreme.ini" section "Curcubeu" key "String"
   alloc $STRING_SHANKER_2 = 360
   0AF4: $STRING_SHANKER_2 = read_string_from_ini_file "cleo\Supreme.ini" section "Curcubeu" key "String"
   chatmsg "%s" -1 $STRING_SHANKER_2
   SAMP.CmdRet[/shcode]

and it set the string in .ini :).
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
You don't need to allocate memory when writing to a file or 0B35.

[shcode=cpp]
0B35: 0@ //SAMP.IsCommandTyped(0@)
0AF5: write_string 0@ to_ini_file "cleo\test.ini" section "Section" key "string"
0B43:
[/shcode]

You need to allocate memory when you read from a file to a variable, also free the memory when you're done with it.
Btw, don't use $ vars, they're shitty and will fuck up other scripts along the way.
 

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
supahdupahnubah said:
alloc $test 256 or your amount?

Alloc memory to write for allowing me to type a bigger string in chat if im using read string


springfield said:
Btw, don't use $ vars, they're shitty and will fuck up other scripts along the way.

This is the answer from many questions of my head, thanks @springfield

thanks @doroftel

sa traiti!
 
Status
Not open for further replies.
Top