HkGetClientIDByShip
-
I am not entirely sure and didnt test it - but i believe the HkGetClientIDByShip must not return the correct client id?
uint HkGetClientIDByShip (uint iShip) { for (uint i = 0; (i <= Players.GetMaxPlayerCount ()); i++) { if (ClientInfo[i].iShip == iShip || ClientInfo[i].iShipOld == iShip) return i; } return 0; } First of all it is not needed to traverse through all available client slots, secondly i think another player with the same ship would be returned although this player is not meant to be processed currently. Unless - and thats the point i am not sure - each client has another ship identifier even if its the same ship they have. Has anyone an idea of what else could be used instead? Maybe assigning more filter criteria to find the correct client id from the ship?[/i][/i]
-
Don’t confuse the ship ID with the CRC of the ships nickname. The function is correct and it is needed to traverse through all the players since we don’t have reversed a function / data field which gets the player ID for a specific ship ID (if there is even such an entry…). You should make yourself clear how FL organizes the objects. Looking for the inheritances between them does also help.
-
I meant its not needed to browse through all clients the currently online players should be enough - or not? As its not needed to process a ship from a player that is not online.
Currently i am not able to test this as i dont have an 2nd pc to go online with a 2nd char to test this (dunno how else i should login with a 2nd char). What brings me still to the question that if char 1 and 2 have the same ship - that the shipIDs are not the same?
No - i would like to know (if that information is yet available) if its totally excluded that the shipID of two different chars might be the same. I have a report about players being killed by players from totally different systems - what is not possible. And the first i could come up with that this routine does not work very accurate. Because this routine is used to determined the killers clientID in the HkCbDeath -> ShipDestroyed Routine.Thanks in advance
-
Players.GetMaxPlayerCount() should return the player count of current active players. If you want you can test the number it returns. Since it is old code, I assume it has been tested a number of times, but you never know.
The bug you wrote about has something to do with fuse kills. At least that’s what I noticed in our mod. Since there is no player who killed the player the code assumes memory garbage for the killer ID (smth. like that). I completely rewrote the killing detection and it is now based on who did the most damage in the last seconds (actually it’s a bit more complicated). I remember getting the actual damage done by a player was quite tough to get.