CLEO Help Draw problem

CLEO related
Status
Not open for further replies.

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
I wanna draw command from .ini file , but probably i doing something wrong...
Who know where is problem?

[shcode=cpp]
0AC8: 4@ = allocate_memory_size 260
0AF4: 4@ = read_string_from_ini_file "cleo\Config.ini" section "Command" key "type"
0AB1: @DRAW_WITH_TEXT_COMMAND_FROM_INI 3 X 162.0 Y 230.0 4@


:DRAW_WITH_TEXT_COMMAND_FROM_INI
03F0: enable_text_draw 1
0342: set_text_draw_centered 1
03E0: draw_text_behind_textures 0
0340: set_text_draw_RGBA 66 195 227 255
033F: set_text_draw_letter_size width 0.205 height 0.955
0349: set_text_draw_font 2
060D: draw_text_shadow 0 rgba 43 43 43 255
033E: set_draw_text_position 0@ 1@ GXT 2@ // "String"
0AB2: 0

[/shcode]

@monday
@springfield
@supahdupahnubah
etc...
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
supahdupahnubah said:
033F: set_text_draw_letter_size width 0.205 height 0.955

This can't be problem, word from .ini is not longest , longest word is NAME + SURNAME and work good with.:
033F: set_text_draw_letter_size width 0.205 height 0.955

Look.:
[img=728x400]https://i.imgur.com/i9lkwQG.png[/img]
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Parazitas said:
supahdupahnubah said:
033F: set_text_draw_letter_size width 0.205 height 0.955

This can't be problem, word from .ini is not longest , longest word is NAME + SURNAME and work good with.:
033F: set_text_draw_letter_size width 0.205 height 0.955

Look.:
[img=728x400]https://i.imgur.com/i9lkwQG.png[/img]

i mean dude you're literally making the size of a text less than a pixel

anyway i might be wrong with the scaling tho, but do you also draw this text in a while loop? it should be drawed every frame
 

Krc

Active member
Joined
Mar 30, 2018
Messages
193
Reaction score
25
Location
Lithuania
Code:
0B91: dialog 1@ add_static id 2@ text 3@ pos_XY 4@ 5@ size 6@ 7@

0AC8: 0@ = allocate_memory_size 260 
0C11: memset destination 0@ value 0 size 260
0B89: dialog 1@ get_control 1 text_to 0@ 
0AF5: write_string 0@ to_ini_file "cleo\config.ini" section "SectionName" key "stringKey"
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Alternative.:
Code:
:DRAW_WITH_TEXT_COMMAND_FROM_INI
{
0AC8: 22@ = allocate_memory_size 260
0AF4: 22@ = read_string_from_ini_file "cleo\Config.ini" section "Command" key "type"
0AB1: @DRAW_WITH_TEXT_COMMAND_FROM_INI 3 X 160.0 Y 230.0 22@
}
03F0: enable_text_draw 1
0342: set_text_draw_centered 1
03E0: draw_text_behind_textures 0
0340: set_text_draw_RGBA 66 195 227 255
033F: set_text_draw_letter_size width 0.205 height 0.955
0349: set_text_draw_font 2
060D: draw_text_shadow 0 rgba 43 43 43 255
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED036' 4@ //// Get gxt text address by gxt name
0AA5: call 0x718600 2 pop 2 4@ 2@ // 2@ = TEXT
033E: set_draw_text_position 0@ 1@ GXT 'CRED036' // "String"
0AB2: 0

or

Code:
{
0AC8: 22@ = allocate_memory_size 260
0AF4: 22@ = read_string_from_ini_file "cleo\Config.ini" section "Command" key "type"
0AB1: @DRAW_WITH_TEXT_COMMAND_FROM_INI 3 X 160.0 Y 230.0 22@
}
:DRAW_WITH_TEXT_COMMAND_FROM_INI
0AC8: 5@ = allocate_memory_size 260
0AD3: 5@ = format "%s" 2@
0C48: samp textdraw 1016 create 5@ pos 0@ 1@
0C4C: samp textdraw 1016 set_style 2
0C52: samp textdraw 1016 set_letter_size width 0.210000 height 0.860000 color 0xFF42C3E3
0AC9: free_allocated_memory 5@
0AB2: 0
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
@supahdupahnubah
Maybe u know why i get crash when use this two opcodes from last answer?

Crash reason flooding in chat.:

SignText: Can't create font Arial
SignText: Can't create font Arial
SignText: Can't create font Arial
SignText: Can't create font Arial
SignText: Can't create font Arial
....
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
I dont know if i need to tell you guys that you cant pass a allocated variable to a function in cleo . . i mean you can but i dont know how or what it was again. . ?!?"31!

Here is what i tested, and it works 100%:


{$CLEO .cs}
0000:


REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY



WHILE TRUE
WAIT 0
0AC8: 1@ = allocate_memory_size 64
0AF4: 1@ = read_string_from_ini_file "cleo\Config.ini" section "Command" key "type"
0AF8: samp add_message_to_chat "STRING_READ: %s" color 0xFF00FF00 1@
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED020' 0@
0AA5: call 0x718600 2 pop 2 0@ 1@
03F0: enable_text_draw 1
0342: set_text_draw_centered 1
03E0: draw_text_behind_textures 0
0340: set_text_draw_RGBA 66 195 227 255
033F: set_text_draw_letter_size width 0.205 height 0.955
0349: set_text_draw_font 2
060D: draw_text_shadow 0 rgba 43 43 43 255
033E: set_draw_text_position 162.0 Y 230.0 GXT 'CRED020' // GXT ARE PREDEFINED . .
0AC9: free_allocated_memory 1@
END
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
I dont know if i need to tell you guys that you cant pass a allocated variable to a function in cleo . . i mean you can but i dont know how or what it was again. . ?!?"31!

Here is what i tested, and it works 100%:


{$CLEO .cs}
0000:


REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY



WHILE TRUE
WAIT 0
0AC8: 1@ = allocate_memory_size 64
0AF4: 1@ = read_string_from_ini_file "cleo\Config.ini" section "Command" key "type"
0AF8: samp add_message_to_chat "STRING_READ: %s" color 0xFF00FF00 1@
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED020' 0@
0AA5: call 0x718600 2 pop 2 0@ 1@
03F0: enable_text_draw 1
0342: set_text_draw_centered 1
03E0: draw_text_behind_textures 0
0340: set_text_draw_RGBA 66 195 227 255
033F: set_text_draw_letter_size width 0.205 height 0.955
0349: set_text_draw_font 2
060D: draw_text_shadow 0 rgba 43 43 43 255
033E: set_draw_text_position 162.0 Y 230.0 GXT 'CRED020' // GXT ARE PREDEFINED . .
0AC9: free_allocated_memory 1@
END

Sorry man , i solved it , all crash i get from other cleo , i check my cleo folder. Anyway Thanks for help guys
And yes i finished it.

[BOT] Auto accept calls from taxi, trucks etc...
sa-mp-014.png

@Opcode.eXe Thanks for turtorial about cursor and opcode 05A5

http://ugbase.eu/index.php?threads/advanced-guis-in-cleo-not-dialogs.18001/#post-105855

Edit.:
This two codes working good without crash my problem was from other cleo.
http://ugbase.eu/index.php?threads/draw-problem.19777/#post-114519
 
Last edited:
Status
Not open for further replies.
Top