- Home /
FPS Multiplayer Scoreboard Problem
Hi guys, I am using M2H networking code (Leepo) for my FPS Multiplayer. And I am facing some problems. The kills and deaths in the playerList of FPSPlayerNode are not updating in foreach loop. In fact, unity doesn't execute that piece of foreach I think. I am giving the code of ApplyDamage() method where I am using foreach loop. Please help guys. Waiting for your friendly opinions. Thanks
void ApplyDamage(string[] info)
{
float damage = float.Parse(info[0]);
string enemyName = info[1];
ScoreBoardScript.killer = enemyName;
hp -= (int)damage;
if (hp <= 0)
{
foreach (FPSPlayerNode entry in oSetup.playerList)
{
if (entry.playerName == enemyName)
{
entry.kills += 1;
}
}
ScoreBoardScript.deaths += 1;
networkView.RPC("isDead", RPCMode.All);
}
else
{
networkView.RPC("SetHP", RPCMode.Others, hp, damage);
}
}
from what i see you are not sending the death-count to your clients...
No actually the RPC "isDead" is doing what you are saying.
well ... i see you send "isDead" ... but it contains no information about the person that was killed ... so how does the client know to which player he has to add score ?
...also ... is this function server-side or client-side?
This ApplyDamage function is client side. It is not a RPC. But I am confusing how to add death score. In short, how to find the person that was killed?
from what i know clients can only call RPCs on the server ... but the applydamage function is client-side ...