Quote:
Originally Posted by deprale
I don't want to be spoon-fed I just want some insight - is it even possible?
|
That's an important sentence that will surely get you more help, it's nice to hear.
And yes, it's possible.
Basically there are major 2 problems here:
1. You've created the variables "frags" and "deaths" as an arrays, which is fine, but you didn't use them like you should.
In this line for example:
PHP Code:
frags=get_user_frags(players[i])
You haven't specified which element in the array you want to change. It should be like this:
PHP Code:
frags[players[i]] = get_user_frags(players[i])
2. Your arrays, "frags" and "deaths", will be deleted from memory each time the function ends. So when a new round will begin "frags" and "deaths" will be 0 and not the values you set.
There are 2 methods of solving this: using
static variables, or using global variables.
Also there's a potential bug that one player will disconnect and another player will get his ID and his frags/deaths. Rare, but possible.
BTW,
roundnumber<<15 should be
roundnumber<15.