OnPlayerSpawn

From SA-MP Wiki

Jump to: navigation, search

OnPlayerSpawn


This callback is called when a player spawns.


Parameters:
(playerid)
playeridID of the player who spawned.


Important Note: This callback is regularly used by scripters to position players upon spawning, for instance hospitalizing them in roleplaying game modes.


This callback does not handle returns.


public OnPlayerSpawn(playerid)
{
    new PlayerName[MAX_PLAYER_NAME],
    string[128]; 
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s has spawned.", PlayerName);
    SendClientMessageToAll(0xFFFFFFFF, string);
}

Related Callbacks

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

Personal tools