Volt

setnamecallmethod

Sets the method name for the current __namecall invocation.

Syntax

setnamecallmethod(method: string) -> void

Parameters

ParameterTypeDescription
methodstringThe new method name

Returns

This function does not return a value.

Description

setnamecallmethod changes the method name that will be used for the current __namecall invocation. This allows you to redirect method calls to different methods.

Example

local oldNamecall
oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
    local method = getnamecallmethod()
    
    -- Redirect Kick to a harmless method
    if method == "Kick" then
        setnamecallmethod("GetFullName")
        return oldNamecall(self, ...)
    end
    
    return oldNamecall(self, ...)
end))

Spoofing Example

local oldNamecall
oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
    local method = getnamecallmethod()
    
    -- Change FireServer to something else for debugging
    if method == "FireServer" then
        print("FireServer intercepted, redirecting...")
        setnamecallmethod("Fire")
    end
    
    return oldNamecall(self, ...)
end))

Notes

  • Only works inside __namecall hooks
  • The change only affects the current call

On this page