Open MasRay29301 opened 2 months ago
Use:
if(IsValidDynamicPlayerTextDraw(playerid, PlayerText:textid))
{
DestroyDynamicPlayerTextDraw(playerid, textid);
}
Use:
if(IsValidDynamicPlayerTextDraw(playerid, PlayerText:textid)) { DestroyDynamicPlayerTextDraw(playerid, textid); }
I used that code but it doesn't work for the script sir
The textdraw doesn't even disappear
Show your codes.
I have this problem too
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]);
}
How To Fix Sir ?