nexquery / samp-textdraw-streamer

A simple plugin for sa-mp and open.mp to break the limits of textdrawings.
Apache License 2.0
33 stars 5 forks source link

[textdraw.streamer] DestroyDynamicPlayerTextDraw: No such id was found. (playerid: 0, textId: 0) (server-package\ui-fivem.pwn:177) #35

Open MasRay29301 opened 2 months ago

MasRay29301 commented 2 months ago

How To Fix Sir ?

nexquery commented 2 months ago

Use:

if(IsValidDynamicPlayerTextDraw(playerid, PlayerText:textid))
{
    DestroyDynamicPlayerTextDraw(playerid, textid);
}
MasRay29301 commented 2 months ago

Use:

if(IsValidDynamicPlayerTextDraw(playerid, PlayerText:textid))
{
    DestroyDynamicPlayerTextDraw(playerid, textid);
}

I used that code but it doesn't work for the script sir

MasRay29301 commented 2 months ago

The textdraw doesn't even disappear

nexquery commented 2 months ago

Show your codes.

MatheusAgL commented 1 month ago

I have this problem too

nexquery commented 1 month ago

This problem is caused by you or the person who made the script you are using. When you delete a textdraw, the plugin completely deletes the ID in the repository. When you try to delete it again, you get this error. Actually, the problem stems from the fact that you don't give -1 value to the textdraw variable after deleting the textdraw.

Incorrect Use:

Test_Textdraw[playerid] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "Test");

PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]); // OK
PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]); // Error

// Or
for(new i = 0; i < 2; i++)
{
    // i == 0  :: OK
    // i == 1  :: Error
    PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]);
}

Correct Usage:

new PlayerText:Test_Textdraw[MAX_PLAYERS];

Test_Textdraw[playerid] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "Test");

if(Test_Textdraw[playerid] != PlayerText:-1)
{
    PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]);
    Test_Textdraw[playerid] = PlayerText:-1;
}

// Or
for(new i = 0; i < 2; i++)
{
    if(Test_Textdraw[playerid] != PlayerText:-1)
    {
        PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]);
        Test_Textdraw[playerid] = PlayerText:-1;
    }
}

// Or
if(IsValidDynamicPlayerTextDraw(playerid, Test_Textdraw[playerid]))
{
    PlayerTextDrawDestroy(playerid, Test_Textdraw[playerid]);
}