TextDraw problem:S
#1

heey guys
I made a day TextDraw. Everything works fine but when a player logs out or in the textdraw bugs.
sa-mp-098.jpg

Код:
if(gametime == 0 && gameday == 1)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Monday");
		TextDrawShowForAll(monday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(saturday);
	}
	if(gametime == 0 && gameday == 2)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Tuesday");
		TextDrawShowForAll(tuesday);
		TextDrawHideForAll(monday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(saturday);
	}
	if(gametime == 0 && gameday == 3)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Wednesday");
		TextDrawShowForAll(wednesday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(monday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(saturday);
	}
	if(gametime == 0 && gameday == 4)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Thursday");
		TextDrawShowForAll(thursday);
		TextDrawHideForAll(monday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(saturday);
	}
	if(gametime == 0 && gameday == 5)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Friday");
		TextDrawShowForAll(friday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(monday);
		TextDrawHideForAll(saturday);
	}
	if(gametime == 0 && gameday == 6)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Saturday");
		TextDrawShowForAll(saturday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(sunday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(monday);
	}
	if(gametime == 0 && gameday == 7)
 	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Sunday");
		TextDrawShowForAll(sunday);
		TextDrawHideForAll(saturday);
		TextDrawHideForAll(tuesday);
		TextDrawHideForAll(wednesday);
		TextDrawHideForAll(thursday);
		TextDrawHideForAll(friday);
		TextDrawHideForAll(monday);
	}
How can i fix this?

Thanks Admigo
Reply
#2

You can use 1 textdraw and just use TextDrawSetString.. I don't know why you made 7 of the same text draws.. Try setting the string of 1 of the text draws and it won't bug.
Reply
#3

I only know how to make numbers strings not word strings:S
And the 7 textdraws are not the same. Its a timer.
Reply
#4

Or i need to change all to playerid?
Reply
#5

Код:
	if(gametime == 0 && gameday == 1)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Monday");
		TextDrawSetString(monday,"Monday");
	}
	if(gametime == 0 && gameday == 2)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Tuesday");
		TextDrawSetString(monday,"Tuesday");
	}
	if(gametime == 0 && gameday == 3)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Wednesday");
		TextDrawSetString(monday,"Wednesday");
	}
	if(gametime == 0 && gameday == 4)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Thursday");
		TextDrawSetString(monday,"Thursday");
	}
	if(gametime == 0 && gameday == 5)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Friday");
		TextDrawSetString(monday,"Friday");
	}
	if(gametime == 0 && gameday == 6)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Saturday");
		TextDrawSetString(monday,"Saturday");
	}
	if(gametime == 0 && gameday == 7)
 	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Sunday");
		TextDrawSetString(monday,"Sunday");
	}
Try that.
Reply
#6

Also you should add [playerid] or edit it for all players in the server. Use a lot of IsPlayerConnected tests
Reply
#7

Quote:
Originally Posted by coole210
Посмотреть сообщение
Код:
	if(gametime == 0 && gameday == 1)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Monday");
		TextDrawSetString(monday,"Monday");
	}
	if(gametime == 0 && gameday == 2)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Tuesday");
		TextDrawSetString(monday,"Tuesday");
	}
	if(gametime == 0 && gameday == 3)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Wednesday");
		TextDrawSetString(monday,"Wednesday");
	}
	if(gametime == 0 && gameday == 4)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Thursday");
		TextDrawSetString(monday,"Thursday");
	}
	if(gametime == 0 && gameday == 5)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Friday");
		TextDrawSetString(monday,"Friday");
	}
	if(gametime == 0 && gameday == 6)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Saturday");
		TextDrawSetString(monday,"Saturday");
	}
	if(gametime == 0 && gameday == 7)
 	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Sunday");
		TextDrawSetString(monday,"Sunday");
	}
Try that.
How can i do it?
Код:
format(string,sizeof(string),"[GAME DAY] %d",gameday);
  	TextDrawSetString(monday,string);
	if(gametime == 0 && gameday == 1)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Monday");
		TextDrawSetString(monday,"Monday");
	}
	if(gametime == 0 && gameday == 2)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Tuesday");
		TextDrawSetString(monday,"Tuesday");
	}
	if(gametime == 0 && gameday == 3)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Wednesday");
		TextDrawSetString(monday,"Wednesday");
	}
	if(gametime == 0 && gameday == 4)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Thursday");
		TextDrawSetString(monday,"Thursday");
	}
	if(gametime == 0 && gameday == 5)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Friday");
		TextDrawSetString(monday,"Friday");
	}
	if(gametime == 0 && gameday == 6)
	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Saturday");
		TextDrawSetString(monday,"Saturday");
	}
	if(gametime == 0 && gameday == 7)
 	{
		SendClientMessageToAll(COLOR_WHITE,"[GAME DAY] Sunday");
		TextDrawSetString(monday,"Sunday");
	}
I dont unserstand the word strings only the number strings:S
Reply
#8

Can someone explain how i can fix this pls?
Reply
#9

If you want it like that try this:

TOP:

Код:
new DayNames[7][50] =
{
{"--"},
{"Monday"},
{"Tuesday"},
{"Wednesday"},
{"Thursday"},
{"Friday"},
{"Saturday"},
{"Sunday"}
};
TIMER:
Код:
format(string,sizeof(string),"[GAME DAY] %s",DayNames[gameday]);
SendClientMessageToAll(COLOR_WHITE,string);
TextDrawSetString(monday,DayNames[gameday]);
Just made your life a lot easier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)