Textdraw string bug
#1

Hi. I got this wierd bug with textdraw string.
The textdraws started mixing into eachother, like admin duty textdraw show up in speedometer textdraw box.
After some research on forums here i re-aranged the textdraws and made them like this:
'new Text:AdminDutyTD = Text:INVALID_TEXT_DRAW; '
It works to some point, then the admin duty textdraw change string to 'Blueberry acres', that belongs in the area textdraw but i cant find a solution that really works.
For now i just did a cheap manipulation with TextDrawSetString inside a timer to set back to ADmin Duty.
But it isnt perfect solution cuz it keeps changing string anyway, even tho it sets back to correct with TDSetString..

Anyone have experience of how to solve this td mess?
Reply
#2

bumping this since its on 2nd page..
Reply
#3

if you have some windows saying xxx byte needed try adding a big enought
pawn Код:
#pragma dynamic xxx
example if you need 2648733 bytes then i write always
pawn Код:
#pragma dynamic 3000000
Sometimes it doesn't slove it...
Reply
#4

I believe this to be a samp bug, this didn't happen in previous samp versions where we had to reshow the textdraw after setting the string. This seemed to start appearing when samp auto updated the textdraw. I to do all the proper INVALID_TEXT_DRAW checks and sets when needed but still this tends to happen. It might be caused by player desync as well, it is very annoying.
Reply
#5

Quote:
Originally Posted by cyber_punk
Посмотреть сообщение
I believe this to be a samp bug, this didn't happen in previous samp versions where we had to reshow the textdraw after setting the string. This seemed to start appearing when samp auto updated the textdraw. I to do all the proper INVALID_TEXT_DRAW checks and sets when needed but still this tends to happen. It might be caused by player desync as well, it is very annoying.
Ok so it wasn't my scripted GM at all! xD
Grr... ;/
Reply
#6

After some time now it bugs into my /stats td, funny thing when i /stats it is showing correctly and when textdraw is closed(TextDrawDestroy) and i do adminduty, the Textdraw shows in the area where statsTD is supposed to be with wrong font :S
Reply
#7

Quote:
Originally Posted by Richie
Посмотреть сообщение
After some time now it bugs into my /stats td, funny thing when i /stats it is showing correctly and when textdraw is closed(TextDrawDestroy) and i do adminduty, the Textdraw shows in the area where statsTD is supposed to be with wrong font :S
Have you tried hiding the textdraw before destroying it? Sometime it helps sometime it doesn't. Some other things to look out for, if you are creating per player textdraws make sure you are setting all the array values to INVALID_TEXT_DRAW for example.....

Код:
new Text:somevar[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...};
Doing that above to make sure all the array values are set to INVALID_TEXT_DRAW otherwise you would only set index 0 to invalid. If you are constantly creating and destroying textdraws do checks like this....

Код:
if(somevar[playerid] == Text:INVALID_TEXT_DRAW) 
{
//Create the textdraw
}
When it comes time to destroy....
Код:
if(somevar[playerid] != Text:INVALID_TEXT_DRAW)
{
    TextDrawHideForPlayer(playerid, somevar[playerid]);
    TextDrawDestroy(somevar[playerid]);
}
Handling your text draws like so does reduce the amount of bugs, however as I stated before it still can mix together and at this time I feel like its more on samp's end. In 0.2x when we had to do TextDrawShow... after TextDrawSetString this problem did not seem to exist at least not that I remember....
Reply
#8

Quote:
Originally Posted by cyber_punk
Посмотреть сообщение
Have you tried hiding the textdraw before destroying it? Sometime it helps sometime it doesn't. Some other things to look out for, if you are creating per player textdraws make sure you are setting all the array values to INVALID_TEXT_DRAW for example.....

Код:
new Text:somevar[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW, ...};
Doing that above to make sure all the array values are set to INVALID_TEXT_DRAW otherwise you would only set index 0 to invalid. If you are constantly creating and destroying textdraws do checks like this....

Код:
if(somevar[playerid] == Text:INVALID_TEXT_DRAW) 
{
//Create the textdraw
}
When it comes time to destroy....
Код:
if(somevar[playerid] != Text:INVALID_TEXT_DRAW)
{
    TextDrawHideForPlayer(playerid, somevar[playerid]);
    TextDrawDestroy(somevar[playerid]);
}
Handling your text draws like so does reduce the amount of bugs, however as I stated before it still can mix together and at this time I feel like its more on samp's end. In 0.2x when we had to do TextDrawShow... after TextDrawSetString this problem did not seem to exist at least not that I remember....
Well Then Kalcynka has to fix the client size code of sa-mp & replace it with old Textdraw code.
Reply
#9

I've been having the same problem too, lately. It started happening after i cleaned up my code (removing spaces and indentations). I noticed that if i rearrange the code block where the textdraw is created, the problem shifts to the textdraw being created in it's place instead.

So let's say i have TD1 which is bugged, if i move the code where i'm creating TD1 below the code where i'm creating TD2, the problem shifts to TD2

Here i've attached images of before and after previews of the textdraw.


Relevant portions of the code
Код:
new Text:CMDTD0;
new Text:CMDTD1;

stock CMDTDs()
{
	CMDTD1 = TextDrawCreate(70.000000, 127.000000, "~g~Commands");
	TextDrawBackgroundColor(CMDTD1, 255);
	TextDrawFont(CMDTD1, 1);
	TextDrawLetterSize(CMDTD1, 0.500000, 1.000000);
	TextDrawColor(CMDTD1, -1);
	TextDrawSetOutline(CMDTD1, 1);
	TextDrawSetProportional(CMDTD1, 1);
	TextDrawSetShadow(CMDTD1, 1);

	CMDTD0 = TextDrawCreate(5.000000, 125.000000,
	"~n~~n~~n~  ~y~1- ~w~Basic Commands~n~  ~y~2- ~w~Animation Commands~n~  ~y~3- ~w~Teleport Commands~n~  ~y~4- ~w~Special Teleport Commands~n~  ~y~5- ~w~Item Commands~n~  ~y~6- ~w~Other Commands~n~~n~		Press ~y~LMB~w~ To Close The Box");
	TextDrawBackgroundColor(CMDTD0, 255);
	TextDrawFont(CMDTD0, 1);
	TextDrawLetterSize(CMDTD0, 0.289999, 0.899999);
	TextDrawColor(CMDTD0, -1);
	TextDrawSetOutline(CMDTD0, 1);
	TextDrawSetProportional(CMDTD0, 1);
	TextDrawUseBox(CMDTD0, 1);
	TextDrawBoxColor(CMDTD0, 110);
	TextDrawTextSize(CMDTD0, 227.000000, 49.000000);
}
public OnGameModeInit()
{
CMDTDs();
}
EDIT: I was able to fix this issue out by cleaning my code. Just did some proper initialization for the textdraws and made sure i called them in the right function. Thanks to Kylesmith for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)