OnPlayerConnect
From SA-MP Wiki
(Difference between revisions)
Revision as of 03:49, 23 November 2014 Pottus (Talk | contribs) (This callback does indeed handle returns.) ← Previous diff |
Revision as of 01:03, 13 May 2015 MP2 (Talk | contribs) Next diff → |
||
Line 24: | Line 24: | ||
{{RelatedCallbacks}} | {{RelatedCallbacks}} | ||
{{OnPlayerDisconnect}} | {{OnPlayerDisconnect}} | ||
+ | {{OnIncomingConnection}} | ||
{{NPC:OnNPCConnect}} | {{NPC:OnNPCConnect}} | ||
Revision as of 01:03, 13 May 2015
Description:
This callback is called when a player connects to the server.
(playerid)
playerid | The ID of the player that connected. |
Return Values:
- 0 - Will prevent other filterscripts from receiving this callback.
- 1 - Indicates that this callback will be passed to the next filterscript.
public OnPlayerConnect(playerid) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"%s has joined the server. Welcome!",pName); SendClientMessageToAll(0xFFFFFFAA,string); return 1; }
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerDisconnect: Called when a player leaves the server.
- OnIncomingConnection: Called when a player is attempting to connect to the server.
- OnNPCConnect: Gets called when the NPC successfully connects to the server.