Textdraws disappearing
#1

Helo.
I got a little problem with my textdraws.
Every time one is created, it will disappear like shown in the video below.
https://www.youtube.com/watch?v=YRe_...ature=*********

Here's the code

at the top
Код:
new Text:clock;
here's the timer
Код:
public TimerSec()
{
	new hour, minute, sek, string[128];
    gettime(hour, minute, sek);
    format(string, sizeof string, "%s%d:%s%d", (hour < 10) ? ("0") : (""), hour, (minute < 10) ? ("0") : (""), minute);
    TextDrawSetString(clock, string);
	foreach(new i : Player)
	{
	    TextDrawShowForPlayer(i, clock);
	}
	return 1;
}
and here's ongamemodeinit
Код:
 	clock = TextDrawCreate(547, 28, "_");
	TextDrawFont(clock, 1);
	TextDrawLetterSize(clock, 0.4, 1.2);
	TextDrawColor(clock, 0xffffffff);
	TextDrawSetShadow(clock, 0);
	TextDrawSetOutline(clock, 1);
	TextDrawAlignment(clock, 0);
	TextDrawBackgroundColor(clock, 0x000000ff);
	TextDrawSetProportional(clock, 1);
Reply
#2

Just one question? Why do you loop every single player when you can use:
TextDrawShowForAll(clock);

Show us the timer? And things around timer?
Reply
#3

That's gotta be one of the most bizzare scripts I've ever seen. I didn't (can't) watch the video so also no idea why it would disappear, TextDrawHide* or TextDrawDestroy on a conflicting ID might cause this.

So, things to correct, in your "TimerSec" public, why loop through all online players when you can use TextDrawShowForAll, also your format was that "most bizzare" thing to me, you can make it simpler:
pawn Код:
format(string, sizeof(string), "%02d:%02d", hour, minute);
The "%02d" will format a number to only 2 decimals (the "2d" part) and a "0" in front signifies pad with zeroes if not long enough, e.g. "09:08" for 9:08AM.

Edit: MicroD was faster, I was writing this "wall of text".
Reply
#4

So turns out, that one of my other textdraws was messing up the rest of them.
Got it fixed.
I loop, because i want that textdraw only to be shown for the players that are logged in. (forgor that line)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)