SA-MP Forums Archive
Send Connect/Left message - 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: Send Connect/Left message (/showthread.php?tid=630116)



Send Connect/Left message - DavidSF - 09.03.2017

Well, how can i send connect/left message to admin, like SendDeathMessage?


Re: Send Connect/Left message - Toroi - 09.03.2017

https://sampwiki.blast.hk/wiki/SendDeathMessageToPlayer

Quote:

Special icons can also be used (ICON_CONNECT and ICON_DISCONNECT).




Re: Send Connect/Left message - Awide - 09.03.2017

You can send the message under this callback:
https://sampwiki.blast.hk/wiki/OnPlayerDisconnect


Re: Send Connect/Left message - DavidSF - 09.03.2017

Okay thanks.


Re: Send Connect/Left message - Aerotactics - 09.03.2017

The other callback you want is OnPlayerConnect.


Re: Send Connect/Left message - oSAINTo - 10.03.2017

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], string[64+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
 
    format(string, sizeof(string), "[ADMIN] %s has disconnected from the server.", name);
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		SendClientMessage(0xC4C4C4FF, string);
	}
    return 1;
}

public OnPlayerConnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], string[64+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
 
    format(string, sizeof(string), "[ADMIN] %s has joined the server.", name);
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		SendClientMessage(0xC4C4C4FF, string);
	}
    return 1;
}
Change: PlayerInfo[playerid][pAdmin] to however you save it in your script.