Quote:
Originally Posted by shauli
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.
|
Appreciate your input, lots of gratitude sir, I'll look more into that.
Very clear explanation and lots of tips, thank you!!! Really, couldn't have asked for more!
EDIT: Just succeeded, using static arrays I managed to get the deaths just fine, now onto fixing the frags issue