Saltar al contenido principal

SetSpawnInfo

Description

This function can be used to change the spawn information of a specific player. It allows you to automatically set someone's spawn weapons, their team, skin and spawn position, normally used in case of minigames or automatic-spawn systems. This function is more crash-safe then using SetPlayerSkin in OnPlayerSpawn and/or OnPlayerRequestClass.

NameDescription
playeridThe PlayerID of who you want to set the spawn information.
teamThe Team-ID of the chosen player.
skinThe skin which the player will spawn with.
Float:spawnXThe X-coordinate of the player's spawn position.
Float:spawnYThe Y-coordinate of the player's spawn position.
Float:spawnZThe Z-coordinate of the player's spawn position.
Float:angleThe direction in which the player needs to be facing after spawning.
WEAPON:weapon1The first spawn-weapon for the player.
ammo1The amount of ammunition for the primary spawnweapon.
WEAPON:weapon2The second spawn-weapon for the player.
ammo2The amount of ammunition for the second spawnweapon.
WEAPON:weapon3The third spawn-weapon for the player.
ammo3The amount of ammunition for the third spawnweapon.

Returns

This function does not return any specific values.

Examples

public OnPlayerRequestClass(playerid, classid)
{
// This simple example demonstrates how to spawn every player automatically with
// CJ's skin, which is number 0. The player will spawn in Las Venturas, with
// 36 Sawnoff-Shotgun rounds and 150 Tec9 rounds.
SetSpawnInfo(playerid, NO_TEAM, 0, 1958.33, 1343.12, 15.36, 269.15, WEAPON_SAWEDOFF, 36, WEAPON_UZI, 150, WEAPON_FIST, 0);
}

Notes

aviso

In case you don't need to set a team to the player, make sure that the "team" parameter is set to NO_TEAM (255).

Team ID 0 in open.mp is a valid team while in SA-MP it is not (SA-MP bug).