0
Answer

how to teleport to another player with ID

john Lotte

john Lotte

7y
236
1
Im using unity3D pls help me,,,How to fix this code? this code work can teleport to player but not targeting player/random player,I want to teleport to another player with iD like , ./tp 1 so will teleport to player with ID 1,,,, here is my code
 
  1. if (this.inputLine.StartsWith("/tp"))  
  2.    {     
  3.     foreach (GameObject obj22 in GameObject.FindGameObjectsWithTag("Player"))  
  4.           {  
  5.             PhotonPlayer player18 = PhotonPlayer.Find(Convert.ToInt32(this.inputLine.Remove(0, 5)));  
  6.             objArray25 = GameObject.FindGameObjectsWithTag("Player");  
  7.             for (num59 = 0; num59 < objArray25.Length; num59++)  
  8.               {  
  9.                     GameObject obj7 = objArray25[num59];  
  10.         if (obj22.GetComponent<HERO>().photonView.isMine)  
  11.                {  
  12.                  obj22.GetComponent<HERO>().transform.position = obj7.GetComponent<HERO>().transform.position;  
  13.                }  
  14.              }  
  15.           }  
  16.     }     
 pleasw help