Jump to content

AntiGui


maffius

Recommended Posts

--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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...