Jump to content
Sign in to follow this  
UNN

IsAdmin function

Recommended Posts

Hi,

Here's a quick function I knocked up. To tell you which player is the Admin, at the start of a multiplayer mission.

Edit: I revised the function so you don't have to worry about names, plus its much simpler now. The new version works like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">IsAdminStart=ctrlShown ((FindDisplay 70) DisplayCtrl 118)

It looks for the padlock image, thats only shown when someone is logged in as an Admin.

I've kept the following code in the post, just in case anyone is interested in looking at the player names. But for detecting who the Admin is at mission starts, it's now been made obselete by the function above I posted above.

UNN_IsStartAdmin.zip

It can be called straight from the init.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_IsAdmin=([Player] Call Compile PreProcessFile "UNN_IsStartAdmin.sqf");

If _IsAdmin Then

{

Hint "You are the Admin at startup";

};

It's possible to also detect who logs in and out, as the Admin, during a mission. But thats more complicated, I posted this function to get the ball rolling.

Here's another I use, to detect if a mission is being played in Multi or Single player.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_IsSinglePlayer=IsNull (FindDisplay 18);

There are loads of things you can now do with the Arma interface, and probably a whole lot more I haven’t thought of. I will try and post different examples in the future. If anyone has other examples, then please post them here to.

Cheers

Share this post


Link to post
Share on other sites

You're one hot sexy momma ... .. UNN!

Very nice found smile_o.gif

One little bug in your example above though:

If (_IsAdmin) Then

{

Share this post


Link to post
Share on other sites

Wow. The benefits of this find are great. Roleplay servers and others who strive for complete control over the mission will be able to do so far more easily now. I honestly thought that it was impossible...

- dRb

Share this post


Link to post
Share on other sites
Quote[/b] ]One little bug in your example above though:

If (_IsAdmin) Then

Thanks, updated. I also added another bit of code, to detect Single or Multiplayer.

The function needs to be changed slightly. Just realised, if you have an Admin called "Saber Slug Sniper Gupi", and a regular player just called "Sabre Slug". Then it will return true for both of them. It just needs to be changed, so it will breakdown the name, and reported ping. Then count the number of characters between them, or something along those lines.

There's another example I will post, that lets you read and edit the chat text in real time. It could offer some interesting alternatives for interacting with the game.

Quote[/b] ]I honestly thought that it was impossible...

Well it still has it's limits. The dialog the Admin is read from, isn't updated when the admin changes during a mission. Like I said, that can be solved, but only for non-password protected logins. Well there is a long winded work around for passowrd protection. But it could be open to abuse, allowing a hacker to obtain the password.

Share this post


Link to post
Share on other sites

Clever stuff doing this without a mod.

Does this mean the vehicle gunner/commander radar HUD could be found and hidden too?

(I realise there's already a 'cover-up' script for that purpose & also mod's that do it.)

Maybe even ability to hide other GUI HUD's (and replace them with better ones)?

Like: weapon/ammo HUD, vehicle damage/ammo HUD, vehicle compass HUD (top row). Edit: Map, scoreboard too.

Let us know, if anyone discovers a way.

Share this post


Link to post
Share on other sites

I don't know about those specific controls, but I have been able to kill the arma map (which also kills compass, watch, gps) by closing one of the dialogs. I forget the ID, but I found it by opening the map and running a loop until it closed... I would assume if you could get the control ID's you could hide specific controls in game too. Warning: when doing it, you have to not close 46 (the main game) and one or two other ones (you can kill the main menu by mistake as well, oops...).

I know that once you kill one of these dialogs in game, I don't think you can bring it back, so perhaps a hide control would be smarter.

I want to find the dialog ID for the scoreboard at some point so I can hide that regardless of server option.

Share this post


Link to post
Share on other sites
Quote[/b] ]Does this mean the vehicle gunner/commander radar HUD could be found and hidden too?

No, I'm afraid not. It will only work for dialog controls that have been assigned an IDC number.

Quote[/b] ]I want to find the dialog ID for the scoreboard at some point so I can hide that regardless of server option.

The scoreboard isn't a dialog or display. At least it's IDC number won't show up like all the other displays. As DR-Eyeball mentioned, you can at least, mask it with another dialog when a player hits the assigned key.

BTW I've found a simpler method for detecting the Admin at mission start. Added the details to the original post.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×