Commands Manager GUI [My First Add-On Ever]

Author Topic: Commands Manager GUI [My First Add-On Ever]  (Read 10628 times)

Worked just fine for me.
[img]http://s23.postimg.org/etmaxt2qz/Test1.png[/img]
[img]http://s16.postimg.org/9b6x5r9k5/Test2.png[/img]
Only because it's on a LAN server.

Only because it's on a LAN server.
No, I was hosting it online? o.O
I can host and you can join if u want to see

No, I was hosting it online? o.O
It's only working because you're the host. It won't work for anyone else that joins the server and it won't work for you on a dedicated server.

messageBoxOk is a client sided function.
And besides:

This dude's add-on is supposed to be client sided. Not server and client sided.
« Last Edit: July 20, 2015, 02:25:51 PM by jes00 »

Goth, can you give up?

It's only working because you're the host. It won't work for anyone else that joins the server and it won't work for you on a dedicated server.
I see... it still works, just in a rather odd way. o.O
Tried switching it to clientCMD, then it broken entirely

If this is the case, how does one get the client of a GUI?
And how would you call a function in the GUI that specifically checks the client?
Code: [Select]
function SomeGUI::onWake(%this,%client)
{
   if(%client.isAdmin)
   {
       //Do stuff
   }
   else
   {
       messageClient(%client,'',"GUI is admin only")
   }
}
?
If it's really that easy then I'm going to kick my own ass, although it still doesn't answer the second part of my Q

Goth, can you give up?
Never!!!!1
« Last Edit: July 20, 2015, 04:11:46 PM by Goth77 »

I see... it still works, just in a rather odd way. o.O
Tried switching it to clientCMD, then it broken entirely

If this is the case, how does one get the client of a GUI?
And how would you call a function in the GUI that specifically checks the client?
Code: [Select]
function SomeGUI::onWake(%this,%client)
{
   if(%client.isAdmin)
   {
       //Do stuff
   }
   else
   {
       messageClient(%client,'',"GUI is admin only")
   }
}
?
If it's really that easy then I'm going to kick my own ass, although it still doesn't answer the second part of my Q
Never!!!!1

only a server command (ex: function serverCmdNAME(%client)) has %client as the first argument by default. If you want to know which client pressed a button, you would call the /name command from the GUI itself.

You would do so like this:
Code: [Select]
// CLIENT SIDED
function myButtonPressed()
{
     CommandToServer('ReceiveGUIData', SomeField.getValue(), SomeOtherField.getValue());
}

// SERVER SIDED
function serverCmdReceiveGUIData(%client, %field1, %field2)
{
    // Do whatever you want with the data they sent.
    if(%client.isAdmin)
    {
         // ??????????
    }
}

See this topic for more info:
http://forum.blockland.us/index.php?topic=227659.0

only a server command (ex: function serverCmdNAME(%client)) has %client as the first argument by default. If you want to know which client pressed a button, you would call the /name command from the GUI itself.

You would do so like this:
Code: [Select]
-epicsnip-

See this topic for more info:
http://forum.blockland.us/index.php?topic=227659.0
Excellent. So you wont have to make a completely separate function for the GUI? That's what I was trying to avoid, actually. I wasn't too sure about how to call parameters from the GUI with CommandToServer since I had never really used it much, but I had an awful hunch there was an easier way to do it without making another whole function just to "reference" the main function if you know what I mean. I knew CommandToServer worked with the client though, so thank you!!

So technically ,
Code: [Select]
function serverCMDcheckValues(%client,%valA,%valB)
{
    if(%client.isAdmin)
    {
         messageClient(%client,''," " @ %valA @ " and " @ %valA @ " ");
    }
    else
    {   
         messageClient(%client,'',"\c0 Admin Only ");
         return;
    }
}
And for the GUI Button Object CMD
Code: [Select]
command = "CommandToServer('CheckValues',GuiTextA.getValue(),GuiTextB.getValue());

Also Sorry Dragonoid for all da offtopic/semi-on-topic codestuffs

Excellent. So you wont have to make a completely separate function for the GUI? That's what I was trying to avoid, actually. I wasn't too sure about how to call parameters from the GUI with CommandToServer since I had never really used it much, but I had an awful hunch there was an easier way to do it without making another whole function just to "reference" the main function if you know what I mean. I knew CommandToServer worked with the client though, so thank you!!

So technically ,
Code: [Select]
function serverCMDcheckValues(%client,%valA,%valB)
{
    if(%client.isAdmin)
    {
         messageClient(%client,''," " @ %valA @ " and " @ %valA @ " ");
    }
    else
    {   
         messageClient(%client,'',"\c0 Admin Only ");
         return;
    }
}
And for the GUI Button Object CMD
Code: [Select]
command = "CommandToServer('CheckValues',GuiTextA.getValue(),GuiTextB.getValue());

Also Sorry Dragonoid for all da offtopic/semi-on-topic codestuffs

Yep that looks like it will work. Have your brother Deokotaru give my Steam to you if you need anymore help.

Wtf is going on anymore? It looks like people are just hating on goth a bunch...

Wtf is going on anymore? It looks like people are just hating on goth a bunch...
Goth was mistaken and fought to prove how he wasn't. In the end, he owned up to his mistake and learned from it. It happens to all of us at some point in life.

Pretty nice, just hope it prompts you for brick clearing or banning.

Also flat buttons where better.

Pretty nice, just hope it prompts you for brick clearing or banning.


Goth was mistaken and fought to prove how he wasn't. In the end, he owned up to his mistake and learned from it. It happens to all of us at some point in life.
The harsh summary of my life in a nutshell. Lol.
I did know there was a way to use CommandToServer to achieve this without using some sort of "reference" function. You helped me understand how use it properly. Thanks for your help Honorabl3

The harsh summary of my life in a nutshell. Lol.
I did know there was a way to use CommandToServer to achieve this without using some sort of "reference" function. You helped me understand how use it properly. Thanks for your help Honorabl3
Anytime. Like I said, if you need anymore help you can add my Steam. I help A LOT of coders from the forums through Steam. My Steam can be found in profile biography.