SA-MP Forums Archive
SendClientMessage mixes up - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessage mixes up (/showthread.php?tid=94949)



SendClientMessage mixes up - MaddDogg14 - 01.09.2009

Hi!
I've got a strange problem with SendClientMessage. Never experienced that until 1 or 2 month ago.

When I send a lot of strings to be displayed by SendClientMessage, sometimes, when I use a lot of strings, they mix up.

I tested this a bit and I can give you the following example:

This is my code, which is triggered, when a CMD is entered:
Код:
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________1________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________2________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________3________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________4________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________5________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________6________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________7________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________8________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________9________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________10________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________11________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________12________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________13________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________14________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________15________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________16________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________17________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________18________________________________________");
SendClientMessage(i, BANKMSG2_COLOR, "___________________________________19________________________________________");
SendClientMessage(i, BANKMSG3_COLOR, "___________________________________20________________________________________");
No problem you'd think. But now have a look at the output (this happens sometimes, but not always):



Don't wonder, where the line with the 6 is, it just got pushed up by the "screenshot taken" message.


So, anyone got a clue?
It also doesn't matter, how long the used strings are. If I used shorter ones, it would have the same result.


Re: SendClientMessage mixes up - brett7 - 01.09.2009

try making a delay between each msg


Re: SendClientMessage mixes up - MaddDogg14 - 01.09.2009

Yea, thought about that..

I just wrote the following code, do you think that this would be the best method to bypass the problem?

Код:
forward msgOutput(playerid, index);
public msgOutput(playerid, index)
{
	switch(index++)
	{
		case 0: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________1________________________________________");
		case 1: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________2________________________________________");
		case 2: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________3________________________________________");
		case 3: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________4________________________________________");
		case 4: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________5________________________________________");
		case 5: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________6________________________________________");
		case 6: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________7________________________________________");
		case 7: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________8________________________________________");
		case 8: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________9________________________________________");
		case 9: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________10________________________________________");
		case 10: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________11________________________________________");
		case 11: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________12________________________________________");
		case 12: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________13________________________________________");
		case 13: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________14________________________________________");
		case 14: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________15________________________________________");
		case 15: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________16________________________________________");
		case 16: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________17________________________________________");
		case 17: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________18________________________________________");
		case 18: SendClientMessage(playerid, BANKMSG2_COLOR, "___________________________________19________________________________________");
		case 19: SendClientMessage(playerid, BANKMSG3_COLOR, "___________________________________20________________________________________");
	}
	
	if(index >= 1 && index <= 19) SetTimerEx("msgOutput", 20, 0, "ii", playerid, index);
	
	
	printf("idx %d", index);
}
And of course, msgOutput gets initially called when the CMD is typed in.