environment
This page describes Neverfair-specific globals and the environment table. Standard Lua libraries are available through LuaJIT.
environment.find_pattern
Searches a loaded module for an IDA-style byte pattern. Use ? as a wildcard. The optional byte offset is added to the matched address. Returns nil when the module is not loaded or the pattern is not found.
local address = environment.find_pattern("client.dll", "48 8B 05 ? ? ? ? 48 85 C0", 3)
if address then
print("pattern found")
end
environment.find_export
Returns the address of an exported function from a loaded module, or nil when the module or export is unavailable.
environment.get_script_name
Returns the file name of the currently running script.
environment.unload_script
Requests the current script to unload safely after the active callback finishes. Registered unload callbacks are called during unloading.
Sends text to Neverfair notifications.
color_t
Creates a color table for API functions. Values can be passed as 0..1 floats or 0..255 numbers.
color_print
Sends colored text to Neverfair notifications. End the text with \0 to continue the same line without a newline.
local accent = color_t(0.2, 0.75, 1.0, 1.0)
local white = color_t(1, 1, 1, 1)
color_print("[neverfair] \0", accent)
color_print("loaded", white)
register_callback
Registers runtime callbacks. Supported built-in callback names:
| Name | Arguments | Description |
|---|---|---|
draw |
none | Called every frame |
paint |
none | Alias for draw |
create_move |
cmd |
Called with the current user_cmd |
override_view |
view |
Called with the current camera view setup |
frame_stage |
stage |
Called on frame stage updates |
frame_stage_notify |
stage |
Alias for frame_stage |
miss |
miss |
Called when the cheat resolves a shot miss reason |
aim_miss |
miss |
Alias for miss |
shot_miss |
miss |
Alias for miss |
edge_bug |
edge_bug_t |
Called with edge bug state on movement commands |
pixel_surf |
pixel_surf_t |
Called with pixel surf state on movement commands |
unload |
none | Called before script unload |
| event name | event |
Called for game event |
register_callback("create_move", function(cmd)
if cmd:get_button(input_bit_mask_t.in_use) then
print("use pressed on command", cmd.command_number)
end
end)
register_callback("miss", function(miss)
print("missed due to", miss.reason, "hc", miss.hitchance)
end)
The miss table contains reason, hitchance, backtrack_ticks, force_shoot, aimpunch, tick, impact_tick, command_number, target_index, target_handle, hitbox, target_velocity, record_simulation_time, record_tick_valid, rage_shot, processed, aim_point, aim_angles, aim_punch, shoot_position, and impact_position.
register_callback("edge_bug", function(edge_bug)
if edge_bug.hit then
menu.notify("edge bug hit")
end
end)
See edge_bug_t for fields.
register_callback("pixel_surf", function(pixel_surf)
if pixel_surf.surfing then
print("pixel surf")
end
end)
See pixel_surf_t for fields.