Overv / WebCraft

Minecraft clone written in Javascript.
zlib License
386 stars 179 forks source link

/kick not working for multiplayer #57

Open Alotario opened 2 years ago

Alotario commented 2 years ago

I have no idea why this is not working, but here is the code for the command:

else if ( msg.substr( 0, 5 ) == "/kick" && client.handshake.address.address == ADMIN_IP ) { var target = msg.substr( 6 ); target = server.findPlayerByName( target );

    if ( target != null ) {
            server.kick( target.socket, "Kicked by literal god" );
            return true;
    } else {
        server.sendMessage( "Couldn't find that player!", client );
        return false;
    }

If someone could help me with this ASAP that would be great.

HotdoGuy90 commented 6 months ago

I know it has been two years since you have posted, but I have found the answer. first replace client.handshake.address.address with server.getIp(client) then find where ADMIN_IP is located and in the empty string write ::ffff:YOUR_IP_HERE sorry i'm a little late but good luck to you and future people who find this post :)

develperbayman commented 6 months ago

I know it has been two years since you have posted, but I have found the answer. first replace client.handshake.address.address with server.getIp(client) then find where ADMIN_IP is located and in the empty string write ::ffff:YOUR_IP_HERE sorry i'm a little late but good luck to you and future people who find this post :)

there should be a badge for this lol :P