SA-MP Forums Archive
Help me ! - 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)
+--- Thread: Help me ! (/showthread.php?tid=635248)



Help me ! - TYDS - 04.06.2017

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


Re: Help me ! - DRIFT_HUNTER - 04.06.2017

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.