Delete a textdraw with a specific text.

Status
Not open for further replies.
Joined
Nov 16, 2017
Messages
23
Likes
2
Points
8
#1
So basically I'm trying to delete a textdraw that has a specific text as soon as samp is ready, I have been converting one of my LUA mods to a CLEO and this is the last bit that I can't get to work.

Here's my LUA code so that you can get an idea of what I'm trying to do:

(under my loop)
PHP:
if removeCount ~= 3 then deleteServerSide() end
(outside my loop)
PHP:
function deleteServerSide()
    for i = 0, 2500 do
        if string.len(sampTextdrawGetString(i)) < 2 and not string.find(sampTextdrawGetString(i), "'") then
            sampTextdrawDelete(i) 
            removeCount = removeCount+1
        end
    end
end
So I'm trying to delete the first 3 textdraws that have the text ' and only the first 3.

Works perfect in LUA but I'm getting close to giving up on the CLEO version, I can't work it out.

Any help would be amazing, tah.
 

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
299
Likes
17
Points
33
Location
Romania
#2
So basically I'm trying to delete a textdraw that has a specific text as soon as samp is ready, I have been converting one of my LUA mods to a CLEO and this is the last bit that I can't get to work.

Here's my LUA code so that you can get an idea of what I'm trying to do:

(under my loop)
PHP:
if removeCount ~= 3 then deleteServerSide() end
(outside my loop)
PHP:
function deleteServerSide()
    for i = 0, 2500 do
        if string.len(sampTextdrawGetString(i)) < 2 and not string.find(sampTextdrawGetString(i), "'") then
            sampTextdrawDelete(i)
            removeCount = removeCount+1
        end
    end
end
So I'm trying to delete the first 3 textdraws that have the text ' and only the first 3.

Works perfect in LUA but I'm getting close to giving up on the CLEO version, I can't work it out.

Any help would be amazing, tah.
Hi there, if you need it for CLEO, that's how you can do it:

Code:
if [email protected] == RPC_SCRTEXTDRAWSETSTRING // or better use RPC_SCRSHOWTEXTDRAW
then                                         
    0BE5: raknet [email protected] = get_hook_param 0
    0BE7: raknet [email protected] = bit_stream_read [email protected] type 2 // Textdraw ID
    0BE7: raknet [email protected] = bit_stream_read [email protected] type 2
  
    if [email protected] == 69 // We will get the string of 69 textdraw
    then
        0AC8: [email protected] = allocate_memory_size 260
        0BE8: raknet bit_stream [email protected] read_array [email protected] size [email protected]
        0C0D: struct [email protected] offset [email protected] size 1 = 0
    
        // Now we got the textdraw string
        0AC9: free_allocated_memory [email protected]
    end
end
If you don't know the ID of textdraw, you can make a loop for all textdraws
 
Status
Not open for further replies.
Top