Problem | Killing list

Options
hello, i'm trying to make killing list (A killed by B).
i made new List named "messages", that saves the text of who kill who, i mean, everytime that someone got killed, the message "A killed by B" will save in the "messages" list.
the problem is that i(A) killing my friend(B) the killing message is saved on his list, and when my friend (B) killing me(A), the killing message saved on my list.
i want to make the listr to be a public list, that everytime my friend kill me in the game, the killing message will be saved on our both list, and not just in one of ours...


this is the script:
public List<string> messages = new List<string>();
	int buildingIndex = 0;

	public string whokillwho;
	public static bool check = false;

[RPC]
   	void Damage(float dmg, PhotonMessageInfo info) 
	{
	         health -= dmg;
		    if (health <= 0)
			{
				check = true;
				whokillwho = (photonView.owner.name + " got hitted by1: " + info.sender.name);
			
				if(photonView.isMine==true)
				{
		            messages.Add(whokillwho);
				}
				if(photonView.isMine==false)
				{
		            messages.Add(whokillwho);
				}
			}
			else 
			{
				Debug.Log("hurt");
		    }
   }



void OnGUI () 
	{
			if(photonView.isMine)
			{
				GUI.Box(new Rect(1,20,100,20), "Health: " + health +"%");
			}
			
			if(check == true)
			{
				for(int i = 0; i < messages.Count; i++)
		        {
					if(photonView.isMine==true)
					{
			            GUI.Label( new Rect(0, 40 + (i * 30), 400, 20), "" + messages[i]);
					}
					if(photonView.isMine==false)
					{
			            GUI.Label( new Rect(0, 40 + (i * 30), 400, 20), "" + messages[i]);
					}
		        }
			}
	}

WHAT'S THE PROBLEM?

Comments

  • UP.
  • tutibueno
    Options
    A good start (and what I used in my game) is a mod of the "Chat" example that comes with the Demo project downloaded from the Asset Store. When a player kills another it will fire an RPC containing a message. The message can, for instance, have the photonView.owner of players involved and then you compose a concatenated string. It is really simple to implement.