mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-24 19:27:16 +00:00
client can use teleport window
This commit is contained in:
parent
2e9c3ca3e0
commit
01b103c34d
1 changed files with 8 additions and 11 deletions
|
@ -43,12 +43,9 @@ namespace SanAndreasUnity.UI {
|
|||
|
||||
public static Transform[] FindSpawnPlaces ()
|
||||
{
|
||||
if (Utilities.NetUtils.IsServer)
|
||||
{
|
||||
var obj = GameObject.Find("Player Spawns");
|
||||
if (obj)
|
||||
return obj.GetComponentsInChildren<Transform> ();
|
||||
}
|
||||
var obj = GameObject.Find("Player Spawns");
|
||||
if (obj)
|
||||
return obj.GetComponentsInChildren<Transform> ();
|
||||
return new Transform[0];
|
||||
}
|
||||
|
||||
|
@ -63,11 +60,8 @@ namespace SanAndreasUnity.UI {
|
|||
protected override void OnWindowGUI ()
|
||||
{
|
||||
|
||||
if (!Utilities.NetUtils.IsServer)
|
||||
return;
|
||||
|
||||
if (null == Ped.Instance) {
|
||||
GUILayout.Label ("Player object not found");
|
||||
GUILayout.Label ("No local ped");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,7 +74,10 @@ namespace SanAndreasUnity.UI {
|
|||
|
||||
if (GUILayout.Button (spawnLocation.name))
|
||||
{
|
||||
Ped.Instance.Teleport (spawnLocation.position, spawnLocation.rotation);
|
||||
if (Utilities.NetUtils.IsServer)
|
||||
Ped.Instance.Teleport (spawnLocation.position, spawnLocation.rotation);
|
||||
else if (Net.PlayerRequests.Local != null)
|
||||
Net.PlayerRequests.Local.RequestTeleport(spawnLocation.position, spawnLocation.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue