Author Topic: Gui Admin button  (Read 2035 times)

How can i make a button in a GUI admin only. (Without putting it on the admin gui)

For example I want the Button to bring up another gui but only admins or super admins could open the gui up.
« Last Edit: October 11, 2008, 12:40:49 AM by Eryehk »

Have the button to open it call a serverCmd to check if the client is admin, and if it is, call a clientCmd to open the GUI.

It's useless though, because the client can easily bypass it.

I know the Client can bypass it but isnt there like "client.superadmin/admin Code Else if type thing?

Code: [Select]
if (%client.isAdmin||%client.isSuperAdmin)

Not exactly what i was meaning but that could work.

You can easily check if you're an admin client-side. The $IamAdmin variable is set to 0 if you're not an admin, 1 if you're an admin and 2 if you're a super admin.

Make a client command for setting the visibility of the button.  Then make the server execute the command when a person becomes admin.
« Last Edit: October 09, 2008, 08:25:18 PM by Trigun »

A person can easily change that variable.  If I would just make a command that sets it visible and have the server command that the button is using check for cient.

In a client-side script:
Code: [Select]
function ClientCMDSetButton(%var)
{
     YourButton.setVisible(%var);
}

In a server-side script:
Code: [Select]
function ServerCMDAdminOnlyCMD(%client)
{
     if(%client.isAdmin||%client.isSuperAdmin)
     {
          messageclient(%client,0,"\c6Yes, you are admin, but, you have just lost the game.");
          %client.player.schedule(1500,kill);
     }
}

You're an idiot Trigun.

$IamAdmin is a client-side variable that is set when the client receives a clientcmdSetAdminLevel(int) command to track whether the client needs to enter a password to get into the admin gui or not. You can't change it to 1 to magically make yourself an admin.

I was implying that the person wanted to make the button invisible when a person isn't admin.  So I said to just make a client command that sets its visibility so it doesn't always show.  You should pay attention to what I am talking about.  Here, let me clean it up in your terms.

I was implying that the person wanted to make the button invisible when a person isn't admin.  So I said to just make a client command that sets its visibility so it doesn't always show.  You should pay attention to what I am talking about.  Here, let me clean it up in your terms.

You're still an idiot. Let me do this in little baby steps for you:

-> Person becomes admin
-> Person gets clientcmdSetAdminLevel(1) sent to them
-> Person's $IamAdmin is set to 1
-> Person can now view admin panel

So wouldn't it be better to check if $IamAdmin is set to 1 when the adminGui is opened, and if it isn't to hide the button. This crap about sending servercmds and clientcmds back and forth would be handicapped. You should pay attention to someone who knows a stuffload more than you.

stuffload of  :iceCream:
Having a variable would be unecessary.  You could just the window as visible when the person becomes admin and set it invisible when they leave the server.

stuffload of  :iceCream:
Having a variable would be unecessary.  You could just the window as visible when the person becomes admin and set it invisible when they leave the server.

Trigun, your an idiot.

stuffload of  :iceCream:
Having a variable would be unecessary.  You could just the window as visible when the person becomes admin and set it invisible when they leave the server.

You are an idiot (for the third time now). The variable ALREADY EXISTS. I highlighted the important parts for you. Maybe I can make a little powerpoint to summarize the main points of this thread too, to just really hammer it home.

$IamAdmin is a client-side variable that is set when the client receives a clientcmdSetAdminLevel(int) command to track whether the client needs to enter a password to get into the admin gui or not. You can't change it to 1 to magically make yourself an admin.
Lol, I didn't read this part.  :cookie:

You should pay attention to what I am talking about.

You should listen to your own advice.