- Home /
change weapon only one player in network
Hello, my problem is I want to make my player to change weapon in my fps but when the player changes weapon also change them to more, if I use networkView.isMine those of most players can not see the gun, as I do to change weapon and only change my character while those of most can see it?
I show the script for weapons:
var m9 : GameObject; var ak :GameObject; var fire : GameObject;
function Update () {
// if (networkView.isMine){
if (verif == 1) {
ak.SetActive (false);
m9.SetActive (true);
}
if (verif == 2) {
ak.SetActive (true);
m9.SetActive (false);
}
}
function OnTriggerEnter (other : Collider){ if (networkView.isMine){ if (other.CompareTag ("M9")) {
m9.SetActive (true);
fire.GetComponent(Shoot).enabled = true;
verif = 1;
}
if (other.CompareTag ("ak47")) {
ak.SetActive (true);
fire.GetComponent(Shoot).enabled = true;
verif = 2;
}
} }
are written in another script keys to switch weapons with a simple switch
sorry for my English, I'm using google translate
a greeting
Your answer
Follow this Question
Related Questions
Weapon Selection Script 1 Answer
Cant Kill Multiplayer Player In Unity, Help! 0 Answers
Problem with RPC life 0 Answers
Detacting Collision Over Photon Network 0 Answers