Help me !
#1

pls explane me the different
1/
Код:
stock SendClientMessageEx(playerid, color, const text[], {Float, _}:...)
{
	static
	    args,
	    str[144];


	if ((args = numargs()) == 3)
	{
	    SendClientMessage(playerid, color, text);
	}
	else
	{
		while (--args >= 3)
		{
			#emit LCTRL 5
			#emit LOAD.alt args
			#emit SHL.C.alt 2
			#emit ADD.C 12
			#emit ADD
			#emit LOAD.I
			#emit PUSH.pri
		}
		#emit PUSH.S text
		#emit PUSH.C 144
		#emit PUSH.C str
		#emit PUSH.S 8
		#emit SYSREQ.C format
		#emit LCTRL 5
		#emit SCTRL 4

		SendClientMessage(playerid, color, str);

		#emit RETN
	}
	return 1;
}
2/
Код:
stock SendClientMessageEx(playerid, color, string[])
{
	if(InsideMainMenu{playerid} == 1 || InsideTut{playerid} == 1 || ActiveChatbox[playerid] == 0)
		return 0;

	else SendClientMessage(playerid, color, string);
	return 1;
}
i get 2 stock at 2 gamemode and which one optimize
Reply
#2

They both do totally different things.

The first one, is used to format and send client message.
pawn Код:
new string[144];
format(string, sizeof(string), "%s %d", someStrVar, someIntVar);
SendClientMessage(playerid, color, string);
instead of doing all that you do
pawn Код:
SendClientMessage(playerid, color, "%s %d", someStrVar, someIntVar);


The second one is just checking few variables and prevents sending client message if player is inside menu, inside tutorial or his chatbox is off.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)