Get player ID by mouse
TopoR1 opened this issue · comments
How can I find the player ID by mouse? Like, you hover over the player, you type the idm command in the chat and the player’s ID is displayed in the chat.
I created this (works for the old MultiOgar):
idm: function (args) {
const mouse = this.playerTracker.mouse;
for (let i = 0; i < this.gameServer.nodesPlayer.length; i++) {
const check = this.gameServer.nodesPlayer[i];
const pos = check.quadItem.bound;
if ((pos.minx <= mouse.x && mouse.x <= pos.maxx) && (pos.miny <= mouse.y && mouse.y <= pos.maxy))
return this.writeLine("The pID of the person you're pointing at is " + check.owner.pID);
}
},
This must be added to PlayerCommand.js