maffius Posted March 23, 2016 Share Posted March 23, 2016 Hello, I want to make an AntiGui script that get text from gui button and if it will be for example "WARP" in gui button, client send it to the server log. Is it possible? Link to comment
Addlibs Posted March 23, 2016 Share Posted March 23, 2016 --Client addEventHandler("onClientGUIClick", root, function (key, state) if guiGetText(source):lower():find("warp") and getElementType(source) == "gui-button" and state == "up" then triggerServerEvent("sendToLog", localPlayer, guiGetText(source)) end end ) --Server addEvent("sendToLog", true) addEventHandler("sendToLog", root, function (buttonText) if client and source and source == client then else return false end --break function if 'client' isn't declared, or if it is different from the event source element (security) outputServerLog("Client "..getPlayerName(client).." pressed button \""..buttonText.."\"") end ) This is pretty much a very minimal code that will trigger a server event when a gui-button, which has "warp" at least as part of it's name, is pressed. The server will catch that event and write to server log the name of the player and the exact name of the button pressed. (UNTESTED, but should work) Link to comment
maffius Posted March 24, 2016 Author Share Posted March 24, 2016 Works perfectly. Thanks a lot! 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