Author Topic: Checking if client is host? [Solved]  (Read 1537 times)

How would I check if a client is the host?
« Last Edit: April 03, 2016, 08:17:21 PM by BloxersPost »

There's a stuffload of chrcks you have to do. I personally hard-code my BL ID.

There's a stuffload of chrcks you have to do. I personally hard-code my BL ID.
Ah, well I'm making a mod that I really need to make a check for it. I plan on releasing sooner or later.

Then an alternative would be adding a pref so the host sets its ID.

Best way: getNumKeyID() == %client.getBLID()
Not the best way for LAN servers

Best way: getNumKeyID() == %client.getBLID()
Not the best way for LAN servers
Aye, thanks man. Never thought of that.

%isHost = (%client.isLocalConnection() || %client.getBLID() == getNumKeyID());

if(%isHost)
{
    echo("Yes");
}

else
{
    echo("No");
}
« Last Edit: April 04, 2016, 07:31:49 AM by jes00 »

Why use BL_ID and not getBLID()? I feel like it's insecure

Why use BL_ID and not getBLID()? I feel like it's insecure
Oops.

Something like this should work on normal servers, lan servers and blocknet servers:

if(%client.isHost || %client.bl_id == 999999 || %client.bl_id == getNumKeyId())

Blocknet servers? What's the difference with them?

Blocknet servers? What's the difference with them?

If you use that rental key thing the actual host will never join the server. I think it sets isHost instead.

Something like this should work on normal servers, lan servers and blocknet servers:

if(%client.isHost || %client.bl_id == 999999 || %client.bl_id == getNumKeyId())
Oh, thanks! I'll use this instead, looks way more reliable.

.isHost is also set by RTB, if you use that.

.isHost is also set by RTB, if you use that.
Ah, thanks. That clears up a question I've had in mind for a while lol. But I'm going to use what Zeblote put because I want to ensure people who don't have RTB may use it as well. Also, thanks for your earlier reply, even if I'm not using it all replies are greatly appreciated.