Destroy OutOfRangeDestroyer script on peds which are controlled by players

This commit is contained in:
in0finite 2019-05-27 21:37:07 +02:00
parent 3869ff0a09
commit f9c8a5d31f
2 changed files with 3 additions and 1 deletions

View file

@ -113,6 +113,8 @@ namespace SanAndreasUnity.Behaviours
var ped = Ped.SpawnPed(Ped.RandomPedId, spawn.position, spawn.rotation);
player.OwnedPed = ped;
ped.WeaponHolder.autoAddWeapon = true;
// this ped should not be destroyed when he gets out of range
ped.gameObject.DestroyComponent<OutOfRangeDestroyer>();
Debug.LogFormat("Spawned ped for player {0}, net id {1}", player.connectionToClient.address, ped.netId);

View file

@ -26,7 +26,7 @@
- change default ped sync rate to 20
- OutOfRangeDestroyer script should be destroyed on clients ; also, it should not be attached to peds owned by players (on server) ;
- OutOfRangeDestroyer script should be destroyed on clients (for vehicles) ; when player controls a vehicle, it should not be destroyed ; or simply make the script destroy objects only on server (if they are network objects) ;
- display a message to user when network is stopped