OnPlayerConnect

From SA-MP Wiki

Jump to: navigation, search


Description:

This callback is called when a player connects to the server.


Image:32px-Ambox_warning_orange.png

Note

This callback can also be called by NPC.


Parameters:
(playerid)
playeridThe 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.
  • It is always called first in filterscripts.


Example Usage:

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.

Personal tools
Navigation
Toolbox