Advertisement
Vzurxy

lua metamethod c

Jun 9th, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. local game_meta = getrawmetatable(game) -- metatable
  2. local __index = game_meta.__index -- index
  3. local __namecall = game_meta.__namecall -- namecall
  4. local hook = newcclosure(function(self,...) -- get whatever object the function was called on
  5. local Self = tostring(self)
  6. local Type = __index(self,"ClassName") -- get the object classname the function was called on
  7. local T = {self, ...}
  8. if T[1] == game.ReplicatedStorage.modules.network["playerRequest_damageEntity"] and typeof(T[2]) == "Instance" and T[4] == "monster" then -- checks if remote being called is this ^
  9. else
  10. return (Type == "RemoteEvent" and new)(self,...) -- make sure it doesnt overwrite
  11. end
  12. end)
  13. new = hookfunction(Instance.new("RemoteEvent").FireServer, hook, true) -- hook it true is optional, but does nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement