SA-MP Forums Archive
OnPlayerConnect - Message to all - 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: OnPlayerConnect - Message to all (/showthread.php?tid=208756)



OnPlayerConnect - Message to all - Ihsan-Cingisiz - 09.01.2011

Hello,

I wanted to disappear the 'Connected to SERVERNAME' message,
so i made a new forward: ShowMessage(playerid); and i made a
timer in OnPlayerConnect: SetTimer("WelcomeMessage", 300, false);
And this is the public WelcomeMessage(playerid); :
Код:
public WelcomeMessage(playerid)
{
	ClearChat(playerid, 10);
	SendClientMessage(playerid, COLOR_NICEBLUE, "[======================|  |======================]");
	SendClientMessage(playerid, COLOR_WHITE,    "Server Last Update: lalal ");
	SendClientMessage(playerid, COLOR_WHITE,    "Server Version: blabla");
	SendClientMessage(playerid, COLOR_WHITE,    "Server Scripter:bdfd ");
	SendClientMessage(playerid, COLOR_WHITE,    "---------------------------------------------------------------------");
	SendClientMessage(playerid, COLOR_WHITE,    "Welcome to blabla Roleplay.");
	SendClientMessage(playerid, COLOR_WHITE,    "Please /login or /register to enter the server.");
	SendClientMessage(playerid, COLOR_NICEBLUE, "[======================|  |======================]");
}
When there are for example two players online and when another player connects to the
server everyone gets the message.. What did i wrong? the (playerid) is just for one player,
isn't it? How can i fix this problem? Thanks.

K. Regards,
I. C.


Re: OnPlayerConnect - Message to all - Calgon - 09.01.2011

In OnPlayerConnect, use this:

pawn Код:
SetTimerEx("WelcomeMessage", 300, false, "i", playerid);
You need to use SetTimerEx to pass the playerid variable to the timer, or it'll send as 0 to the playerid variable. You also might want to change the timer time, 300 is in milliseconds, if you want to keep it that way, you're better off just putting the client messages directly in OnPlayerConnect.