From 000a8a6cc96ab71b13edaf3832f6f883ddfde7a2 Mon Sep 17 00:00:00 2001 From: in0finite Date: Mon, 22 Feb 2021 20:21:14 +0100 Subject: [PATCH] revert adaption --- Assets/Scripts/Behaviours/UIVehicleSpawner.cs | 8 ++++++-- Assets/Scripts/UI/UtilitiesWindow.cs | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Behaviours/UIVehicleSpawner.cs b/Assets/Scripts/Behaviours/UIVehicleSpawner.cs index 277e2ced..093a3b58 100644 --- a/Assets/Scripts/Behaviours/UIVehicleSpawner.cs +++ b/Assets/Scripts/Behaviours/UIVehicleSpawner.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using SanAndreasUnity.Utilities; +using UnityEngine; namespace SanAndreasUnity.Behaviours { @@ -14,7 +15,10 @@ namespace SanAndreasUnity.Behaviours { if (Ped.Instance != null) { - Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer("/veh"); + if (NetUtils.IsServer) + Vehicles.Vehicle.CreateRandomInFrontOf(Ped.Instance.transform); + else + Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer("/veh"); } } } diff --git a/Assets/Scripts/UI/UtilitiesWindow.cs b/Assets/Scripts/UI/UtilitiesWindow.cs index 08494b1c..ae77ce28 100644 --- a/Assets/Scripts/UI/UtilitiesWindow.cs +++ b/Assets/Scripts/UI/UtilitiesWindow.cs @@ -2,6 +2,7 @@ using UnityEngine; using SanAndreasUnity.Behaviours; using System.Linq; +using SanAndreasUnity.Behaviours.Vehicles; namespace SanAndreasUnity.UI { @@ -56,7 +57,7 @@ namespace SanAndreasUnity.UI { if (GUILayout.Button ("Spawn random vehicle")) { if (Ped.Instance != null) - SendCommand("/veh"); + Vehicle.CreateRandomInFrontOf(nearbyTransform); } if (GUILayout.Button("Change player model"))