OnPlayerSpawn
From SA-MP Wiki
This callback is called when a player spawns.
(playerid)
| playerid | The ID of the player that spawned |
| Returns | Return 0 in this callback to force the player back to class selection when they next respawn |
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); return 1; }
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 respawns.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- SpawnPlayer: Force a player to spawn.
- AddPlayerClass: Add a class.
- SetSpawnInfo: Set the spawn setting for a player.
