mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +00:00
add flag "addWeaponsToSpawnedPlayers"
This commit is contained in:
parent
985054b648
commit
fb332a40c0
1 changed files with 5 additions and 2 deletions
|
@ -16,6 +16,8 @@ namespace SanAndreasUnity.Behaviours
|
|||
public float spawnInterval = 4f;
|
||||
float m_lastSpawnTime = 0f;
|
||||
|
||||
public bool addWeaponsToSpawnedPlayers = true;
|
||||
|
||||
public static SpawnHandler DefaultSpawnHandler { get; } = new SpawnHandler();
|
||||
|
||||
private SpawnHandler m_spawnHandler = DefaultSpawnHandler;
|
||||
|
@ -147,14 +149,15 @@ namespace SanAndreasUnity.Behaviours
|
|||
|
||||
}
|
||||
|
||||
public static Ped SpawnPlayer (Player player, TransformDataStruct spawnPlace)
|
||||
public Ped SpawnPlayer (Player player, TransformDataStruct spawnPlace)
|
||||
{
|
||||
if (player.OwnedPed != null)
|
||||
return null;
|
||||
|
||||
var ped = Ped.SpawnPed(Ped.RandomPedId, spawnPlace.position, spawnPlace.rotation, false);
|
||||
ped.NetPlayerOwnerGameObject = player.gameObject;
|
||||
ped.WeaponHolder.autoAddWeapon = true;
|
||||
if (this.addWeaponsToSpawnedPlayers)
|
||||
ped.WeaponHolder.autoAddWeapon = true;
|
||||
// this ped should not be destroyed when he gets out of range
|
||||
ped.gameObject.DestroyComponent<OutOfRangeDestroyer>();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue