m-byte918 / MultiOgarII

A continued version of the original MultiOgar, an open source Ogar server implementation written with Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get player ID by mouse

TopoR1 opened this issue · comments

commented

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.

commented

This does not work :( #1147

commented

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