CLEO Help [LOCK] Print string in a part of the screen [LOCK]

CLEO related
Status
Not open for further replies.

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Hi,

In the cleo ADMIN CHECKER, we have the name id and level of a player in our screen.

1426394001-lll.png


I would like to know how does he generate this big string ?

I tried with in a function
Code:
 25@ = samp.GetPlayerNickname(0@)
 0C15: destination strcpy 25@ [some stuf]
 0C15: destination strcpy 25@ [some stuf]
 0C15: destination strcpy  25@ [some stuf]
0D94: draw_text 25@ pos_xy 50 450 align_xy 0.5 0.0 color 0xFF0000 shadow 1

But it doesn't work very well for me.  :imoverit:

Any solution please ?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Re: print string in a part of the screen

Like this:

0AC8: 0@ = allocate_memory_size 260
0B2B: samp 1@ = get_player_id_by_actor_handle 2@
0AD3: 0@ = format "ID: %d, LOLOLO" 1@
0D94: draw_text "IDS:" pos_xy 64 64 align_xy 0.5 0.0 color 0xFF0000 shadow 1
0D94: draw_text 0@ pos_xy 100 100 align_xy 0.5 0.0 color 0xFF0000 shadow 0
0AC9: free_allocated_memory 0@
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Re: print string in a part of the screen

Did something like this a while ago, for other stuff, not admins.
Just use the example.

Code:
{$CLEO}
0000:

repeat
    wait 40
until SAMP.Available()

0B6D: render 0@ = create_font "Arial" height 11 flags 5


WHILE TRUE
WAIT 0
    alloc 1@ = 260
    alloc 2@ = 260
    0C11: memset 2@ val 0 sz 260
    
    FOR 3@ = 0 TO 999
        IF 0B23:  samp is_player_connected 3@
        THEN IF 0B20: 7@ = actor_handle 3@
            THEN
                0B65: samp 4@ = player 3@ score
                0B36: samp 5@ = get_player_nickname 3@
                
                0AD3: 1@ = "%s[%d]: S:[%d] %c" 5@ 3@ 4@ 0xA /*Name/ID/Score*/
                0C15: strcat destination 2@ source 1@
                6@++ /*count*/
            END
        END
    END
    0AD3: 1@ = "StreamedPlayers: [%d]" 6@
    Render.DrawText(0@, 1@, 20, 460, -1)
    Render.DrawText(0@, 2@, 20, 480, 0xFFC0FF01)
    free 1@
    free 2@ 
    6@ = 0  
END

V2C9UP8.png
 

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Re: print string in a part of the screen

Opcode.eXe link said:
Like this:

0AC8: 0@ = allocate_memory_size 260
0B2B: samp 1@ = get_player_id_by_actor_handle 2@
0AD3: 0@ = format "ID: %d, LOLOLO" 1@
0D94: draw_text "IDS:" pos_xy 64 64 align_xy 0.5 0.0 color 0xFF0000 shadow 1
0D94: draw_text 0@ pos_xy 100 100 align_xy 0.5 0.0 color 0xFF0000 shadow 0
0AC9: free_allocated_memory 0@


UP !
New SAMPFUNC merged with MGFUNC but this opcode: 0D94: draw_text is not available.

How to replace 0D94 ?
 

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Re: Print string in a part of the screen

Thx for you answer.

Well,

I tried your version, I got this:

Code:
While

[blablabla intruction blablabla]

       0B6D: render 7@ = create_font "Arial" height 11 flags 5         
       0AC8: 30@ = allocate_memory_size 260
       0AD3: 30@ = "{FFFFFF}Joueur: {00FC4C}%s{FFFFFF} ({00FC4C}%d{FFFFFF})" 6@ 5@
       31@ += 15
       03F0: enable_text_draw 1  
       Render.DrawText(7@, 30@, 200, 460, -1)
       0AC9: free_allocated_memory 30@

It works, but after 8 or 9 second, I got a series of opcode error, then the text disapear.

Maybe it's the declaration of 7@ because I declare it in the while and not at the start of the code

What should I do ?
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Re: Print string in a part of the screen

Code:
0B6D: render 7@ = create_font "Arial" height 11 flags 5  //you call this once, unless you want to change the font in real time; if so you need to call 0B6E: render release_font 1@ before recreating the font
//calling it every ms will result in low fps, calling it without proper release(0B6E) will result in crash.

While

[blablabla intruction blablabla]
       0AC8: 30@ = allocate_memory_size 260
       0AD3: 30@ = "{FFFFFF}Joueur: {00FC4C}%s{FFFFFF} ({00FC4C}%d{FFFFFF})" 6@ 5@
       31@ += 15
       //03F0: enable_text_draw 1 - this is to be used with gta native textdraws, useless in this case
       Render.DrawText(7@, 30@, 200, 460, -1)
       0AC9: free_allocated_memory 30@
end
 
Status
Not open for further replies.
Top