| Blockland Forums > Modification Help |
| Get client from GUI? |
| (1/2) > >> |
| Greek2me:
There must be a way to do this, but I can't figure it out. How do you get the client that clicked a button in your GUI? I did find one thing: GUI.getClient(); but when you run that on a LAN server you get an error message saying that it only works on internet servers. Is there any other way to get the client that works no matter server type? |
| Nexus:
Well, the way a gui is set up is that when you click a button, you want it to send a commandToServer() to the server. The server recieves it as a slash command, and it starts by default with the %client. The server can then send a commandToClient() back. |
| Amade:
What is it that you're trying to do? If you're always trying to get the local client, it's always simply named localclientconnection. |
| Greek2me:
--- Quote from: Nexus on February 02, 2011, 02:27:03 AM ---Well, the way a gui is set up is that when you click a button, you want it to send a commandToServer() to the server. The server recieves it as a slash command, and it starts by default with the %client. The server can then send a commandToClient() back. --- End quote --- That won't work because I need to run a bunch of stuff client side first and then send all the data to the server. --- Quote from: Amade on February 02, 2011, 02:56:18 PM ---What is it that you're trying to do? If you're always trying to get the local client, it's always simply named localclientconnection. --- End quote --- Ah, thanks. EDIT: Wait, localclientconnection will give me the client that's running the GUI? That's what I need. |
| Amade:
--- Quote from: Greek2me on February 02, 2011, 03:09:39 PM ---That won't work because I need to run a bunch of stuff client side first and then send all the data to the server. Ah, thanks. EDIT: Wait, localclientconnection will give me the client that's running the GUI? That's what I need. --- End quote --- In client sided code, localclientconnection is always the controlled client. If you're talking about server-sided code then you'll have to rely on server commands. |
| Navigation |
| Message Index |
| Next page |