megaman54 Posted December 7, 2010 Share Posted December 7, 2010 How to send data from a GUI edit box to a server? Or any GUI data, like memos, edit boxes and all. Link to comment
Aibo Posted December 7, 2010 Share Posted December 7, 2010 see GUI functions in wiki: https://wiki.multitheftauto.com/wiki/Cli ... _functions basically you'll need to get values from your gui element and trigger a server event to send it: local someGUIeditValue = guiGetText(someGUIelement) -- works for windows/buttons/edits/etc local someGUIscrollValue = guiScrollBarGetScrollPosition(someGUIscrollbar) -- scrollbar position local someGUIcheckboxValue = guiCheckBoxSetSelected(someGUIcheckbox) -- true/false from checkbox -- etc triggerServerEvent("someGUI2ServerEvent", getLocalPlayer(), someGUIeditValue, someGUIscrollValue, someGUIcheckboxValue) -- event needs to be added/handled on the server Link to comment
megaman54 Posted December 7, 2010 Author Share Posted December 7, 2010 Ok thanks i'm making a moderator panel so this was needed. EDIT: When data is in server side, transferred with event, how to handle it server side? Like this: i have a edit box and a button. I write someones name to the edit box and press the button. Event gets triggerded and data went to server side script, and now the server should kick that player with the name i typed in the edit box. How to make this happen? Link to comment
Aibo Posted December 7, 2010 Share Posted December 7, 2010 well you have to handle this event: function adminKickPlayer(editbox) -- here's the editbox value you've passed from client local player = getPlayerFromName(editbox) -- getting the player from name containd in editbox if player then -- player found, kick him: kickPlayer(player) else -- output to event source (you) that player not found: outputChatBox("Player with name '"..editbox.."' not found", source) end end addEvent("someGUI2ServerEvent", true) -- adds event on the server, so it could be triggered addEventHandler("someGUI2ServerEvent", getRootElement(), adminKickPlayer) -- attached event handler its all on the wiki, actually. Link to comment
megaman54 Posted December 8, 2010 Author Share Posted December 8, 2010 Thanks!! Now i got it I tried this a month ago and failed, but now, i will success thanks to you Link to comment
CowTurbo Posted December 8, 2010 Share Posted December 8, 2010 why you making moderator panel ? Admin panel is already a moderator panel too, with some thing's accec denied..... Link to comment
megaman54 Posted December 8, 2010 Author Share Posted December 8, 2010 why you making moderator panel ? Admin panel is already a moderator panel too, with some thing's accec denied..... Well, i'm making a smaller admin/moderator panel because some of my admins and moderators got a slow computer so the big admin panel lags for them. Only basic things in my panel Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now