Author Topic: How to Detect if Someone is Host?  (Read 877 times)

How can I detect is Someone is Host?

at the moment I know:

IsAdmin() = Check if User is an Admin
IsSuperAdmin() = Check if a User is a Super Admin

Is the one for host IsHost()?

Code: [Select]
(%client.getRawIP() $= "local")
I think...

It probably won't work for dedicated servers, you'll have to check %client.bl_id against some pref.

You can use

Code: [Select]
if(%client.bl_id $= getNumKeyID())
for a dedicated server.

How can I Detect if a Server is Dedicated then?

Code: [Select]
if($Server::Dedicated)
 //Server is dedicated

From that, then:
Code: [Select]
if(($Server::Dedicated && %client.bl_id $= getNumKeyID()) || %client.getRawIP() $= "local")
 //%client is the server host

EDIT: Actually, I just checked, getNumKeyID() seems to work on a client copy as well, so just use what Ephialtes had:
Code: [Select]
if(%client.bl_id $= getNumKeyID())
 //%client is the server host
« Last Edit: October 09, 2008, 01:03:36 PM by Space Guy »

Thanks Space Guy!

You Are God!

So, How can I get the current host of the server if it is not myself?

Is there a Setting I can Detect in a Server or something?

You can use getNumKeyID() server-side to get the BL ID of the server.

Code: [Select]
function getLocal() {
%count = ClientGroup.getCount();
for (%cl = 0; %cl < %count; %cl++) {
%client = ClientGroup.getObject(%cl);
if($Server::Dedicated)
if(%client.bl_id == getNumKeyID())
return %client;
else
if(%client.getRawIP() $= "local")
return %client;

}
}