function isBL_IDAdmin(%id) {
// check for manual admin
if(isobject(%client = findclientbybl_id(%id)))
if(%client.isadmin || %client.issuperadmin)
return true;
// parse admin list
%count = getWordCount($Pref::Server::AutoAdminList);
for(%i=0; %i < %count; %i++) {
%guy = getWord($Pref::Server::AutoAdminList, %i);
if(%guy == %id)
return true;
}
// parse super-admin list
%count = getWordCount($Pref::Server::AutoSuperAdminList);
for(%i=0; %i < %count; %i++) {
%guy = getWord($Pref::Server::AutoSuperAdminList, %i);
if(%guy == %id)
return true;
}
// ...is it the host?
if(%id == getNumKeyID()) {
return true;
}
return false;
}
Usually when you check a player is admin you do it through %client.isAdmin and/or %client.isSuperAdmin. This code is for checking the admin status of people who may or may not be on the server. As far as I can tell, it works in all situations. If you come up with a better or more optimized version feel free to post it under this one.
EDIT: Added an amendment by Zeblote.