HookNative
Allows you to hook into FiveM's native function system, giving you complete control over whether native functions execute and what values they return.
Syntax
Susano.HookNative(native_hash, hook_function)Parameters
Return(s)
Hook Function
Your hook function receives the same arguments as the original native and must return specific values to control behavior.
Return Format
return call_original, return_value1, return_value2, ...call_original (boolean)
true- Execute the original native functionfalse- Block the native and use your custom return values
return_value1, return_value2, ... (any)
Custom values to return when blocking the native
Must match the expected return types of the original native
Example(s)
-- Always return "Admin" instead of actual player name
Susano.HookNative(0x6D0DE6A7B5DA71F8, function(player_id)
return false, "Admin"
end)-- Only block for specific players
Susano.HookNative(0x6D0DE6A7B5DA71F8, function(player_id)
if player_id == 1337 then
return false, "BlockedPlayer"
else
return true -- Allow original function
end
end)-- Some natives return multiple values
Susano.HookNative(0x34CFC4C2A38E83E3, function(camTo, camFrom, duration)
if duration > 5000 then
return false, "TooLong", 0, false
end
return true
end)-- Log native calls without modifying behavior
Susano.HookNative(0x6D0DE6A7B5DA71F8, function(player_id)
print(string.format("GetPlayerName called for player: %d", player_id))
return true -- Allow original execution
end)Last updated