OnPlayerSpawn

From SA-MP Wiki

Jump to: navigation, search


Description:

This callback is called when a player spawns.(i.e. after caling SpawnPlayer function)


Image:32px-Ambox_warning_orange.png

Note

This callback can also be called by NPC.


Parameters:
(playerid)
playeridThe ID of the player that spawned.


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.


Image:32px-Ambox_warning_orange.png

Note

The game sometimes deducts $100 from players after spawn.


Example Usage:

public OnPlayerSpawn(playerid)
{
    new PlayerName[MAX_PLAYER_NAME],
    string[40]; 
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s has spawned successfully.", PlayerName);
    SendClientMessageToAll(0xFFFFFFFF, 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.


Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

Personal tools
Navigation
Toolbox
In other languages