Is this a bug? Perhaps textdraw related.
#1

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?
Reply
#2

scripting flaw.

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

else everything gets messed up, even the pause menu
Reply
#4

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

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
Reply
#6

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:
Reply
#7

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.
Reply
#8

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?
Reply
#9

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

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.
Reply
#11

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.
Reply
#12

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
Reply
#13

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.
Reply
#14

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.
Reply
#15

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.
Reply
#16

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)