Advertisement
Noneatme

Untitled

Jan 6th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. cFunc["runcode_check"] = function(dataName, oldValue)
  2.     if(getElementType(source) == "player") and (checkClient(false, source, "onElementDataChange", dataName )) then
  3.         local ndata = getElementData(source, dataName)
  4.         mtSetElementData(source, dataName, oldValue )
  5.         outputLogger(getPlayerName(source), "Runcode Warning", "Data Name: "..dataName, nil, nil, "Old Value: "..tostring(oldValue)..", new Value: "..tostring(ndata))
  6.         return
  7.     end
  8. end
  9.  
  10. -- Taken from the Admin resource
  11.  
  12. function checkClient(checkAccess,player,...)
  13.     if client and client ~= player then
  14.         local desc = table.concat({...}," ")
  15.         local ipAddress = getPlayerIP(client)
  16.         outputDebugString( "Admin security - Client/player mismatch from " .. tostring(ipAddress) .. " (" .. tostring(desc) .. ")", 1 )
  17.         cancelEvent()
  18.         return true
  19.     end
  20.     return false
  21. end
  22. -- EVENT HANDLERS --
  23. addEventHandler("onElementDataChange",getRootElement(), cFunc["runcode_check"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement