Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MasRay29301 opened this issue May 2, 2024 · 7 comments

Comments

@MasRay29301
Copy link

No description provided.

@MasRay29301
Copy link
Author

How To Fix Sir ?

@nexquery
Copy link
Owner

nexquery commented May 2, 2024

Use:

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

@MasRay29301
Copy link
Author

Use:

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

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

@MasRay29301
Copy link
Author

The textdraw doesn't even disappear

@nexquery
Copy link
Owner

nexquery commented May 2, 2024

Show your codes.

@MatheusAgL
Copy link

I have this problem too

@nexquery
Copy link
Owner

nexquery commented May 28, 2024

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]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants