SA-MP Forums Archive
Is this a bug? Perhaps textdraw related. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is this a bug? Perhaps textdraw related. (/showthread.php?tid=335852)



Is this a bug? Perhaps textdraw related. - admantis - 20.04.2012

Hey there, one of my players have recently got this bug (also have done others), where all the GUI gets messy and the textdraws become blocks (even clientside textdraws like the money bar):


Anyone else has experienced this, and if yes, it was a scripting flaw or a SA:MP flaw?


Re: Is this a bug? Perhaps textdraw related. - Lorenc_ - 20.04.2012

scripting flaw.

make sure you used the '~' symbols properly in gametexts and textdraws


AW: Is this a bug? Perhaps textdraw related. - Meta - 20.04.2012

else everything gets messed up, even the pause menu


Re: Is this a bug? Perhaps textdraw related. - kizla - 20.04.2012

You mess up something, becouse no one else haven't that problem


Re: Is this a bug? Perhaps textdraw related. - ][Noname][ - 20.04.2012

Quote:

make sure you used the '~' symbols properly in gametexts and textdraws

only this can be a reason for this bug, if you set "blablabla~n" you will see this bug


AW: Re: Is this a bug? Perhaps textdraw related. - Meta - 20.04.2012

Quote:
Originally Posted by kizla
View Post
You mess up something, becouse no one else haven't that problem
I already expirienced that very often, also on my own servers. Just try it yourself and post then D:


Re: Is this a bug? Perhaps textdraw related. - MP2 - 20.04.2012

I use the following functions to ensure this never happens:

pawn Code:
stock CountChars(txt[],ch='~')
{
    new d,cnt;
    while(txt[d] != EOS)
    {
        if(txt[d] == ch) cnt++;
        d++;
    }
    return cnt;
}
Then check if the number of ~'s in the gametext is odd with ******' isodd().

If it's something like /announce you could show an error, but if it's a gametext in part of your mode, it'll be a bit more tricky. I would suggest making a GameTextForPlayerEx() function or something, and in that function if there are an odd number of ~'s, don't show the gametext and log it to a file, then you can keep an eye on that file to find out which gametext string is causing it.

Good luck.


Respuesta: Is this a bug? Perhaps textdraw related. - admantis - 20.04.2012

Thanks everybody, I'll check that function (thanks for it) and see what I can do.

EDIT: I checked into every possible textdraw in my gamemode and this still happens, are you sure this is a scripting flaw?


Re: Is this a bug? Perhaps textdraw related. - zgintasz - 20.04.2012

Hm, thing like this was happened for me using TextDraw editor... I fixed it, by removing ~, because it was unnecessary.


Re: Respuesta: Is this a bug? Perhaps textdraw related. - MP2 - 20.04.2012

Quote:
Originally Posted by admantis
View Post
EDIT: I checked into every possible textdraw in my gamemode and this still happens, are you sure this is a scripting flaw?
Yes, I'm not exactly sure what causes it, but it's highly likely the misuse of ~'s.


AW: Is this a bug? Perhaps textdraw related. - Drebin - 20.04.2012

If you use too many/too less ~s, the client will most likely crash.
However, if you time ~i~ (or smth like that), there will be a white square on the player's screen. Might also have to do with that.


AW: Is this a bug? Perhaps textdraw related. - Meta - 20.04.2012

Quote:
Originally Posted by Drebin
Посмотреть сообщение
However, if you time ~i~ (or smth like that), there will be a white square on the player's screen. Might also have to do with that.
nope.amx


Re: Is this a bug? Perhaps textdraw related. - iPLEOMAX - 21.04.2012

It's NOT AT ALL related to scripting. It's a game bug.

2 reasons I experienced this before:
- Switching from windowed mode to fullscreen.
- Having a background app using D3D Renderer.


Re: Is this a bug? Perhaps textdraw related. - admantis - 21.04.2012

Assuming that the use of ~ characters were incorrect, the consecuences would be a client crash, not bugged interface. I did a few tests with a gametext and the results were:

~~hi CRASH
~n~hi~ CRASH
~ CRASH
~g~hi~n~~ CRASH
~r~~~n~ CRASH

I've tried other combinations and still, but what's weird, it happens randomly while my players are simply driving around.


Re: Is this a bug? Perhaps textdraw related. - TheBetaFox - 21.04.2012

Quote:
Originally Posted by admantis
Посмотреть сообщение
Assuming that the use of ~ characters were incorrect, the consecuences would be a client crash, not bugged interface. I did a few tests with a gametext and the results were:

~~hi CRASH
~n~hi~ CRASH
~ CRASH
~g~hi~n~~ CRASH
~r~~~n~ CRASH

I've tried other combinations and still, but what's weird, it happens randomly while my players are simply driving around.
This happened to me multiple times while in Zamaroht's TextDraw Editor, when not using enough ~'s here and there. Yes, sometimes it did result in a crash - but not always.


Respuesta: Is this a bug? Perhaps textdraw related. - admantis - 21.04.2012

Alright, but I'm still not sure what causes it because it happens only randomly and sometimes, for example, I was driving around and suddenly blocky GUI. This can be fixed by relogging but that's not the best solution! I start suspecting it's the speedometer code with a update frequency of 1000 milliseconds, which the whole text merged with strcat would look like this:

Код:
~r~engine~r~seatbelt~n~~w~fuel:~b~ %d~n~~w~health:~b~ %0.1f~n~~w~speed:~b~ %d~n~~w~miles:~b~ %0.1f
I've put this code to check if the amount of ~ is even or odd, and it returned it was even. I really can't determine the flaw, I'd really appreciate a hand.