OnPlayerSpawn
From SA-MP Wiki
OnPlayerSpawn
This callback is called when a player spawns.
(playerid)
| playerid | ID 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.
- OnPlayerDeath: Called when a player dies.
- OnVehicleSpawn: Called when a vehicle spawns.
