OneSync: intercepting game events (such as explosions)

The latest version of the server (1543+) added support for parsing and preventing routing of game events. This currently only supports parsing CExplosionEvent, but this might be a fairly useful one to prevent routing of ‘excessive’ explosions, or explosions that are ‘too close’ to a player and not of the correct weapon type. Here’s an …

Two new experimental OneSync variables

In the latest Windows server release (1504 or higher), two experimental variables have been added to help troubleshooting problematic behavior and offer a ‘workaround’ for common problems. onesync_distanceCullVehicles true This console variable (set it in your config, or in the console at runtime) will lead to player-occupied vehicles also being subject to distance culling – …

Useful snippet: getting the top left of the minimap in screen coordinates

This could be useful if you want to align things to NUI or other screen-space draws, and works on pretty much any aspect ratio. The magic numbers here are the minimap position from common:/data/ui/frontend.xml, as seen below: This will likely also work for aligning to other positions, assuming you set the right sizes.

Improving script stack traces

In the past, the Citizen framework scripting runtime would print really messy stack traces such as.. this: This stack trace goes on for around 3-4 times the displayed length, and is generally.. a big mess. You can tell that some resource code is running, like @stest3/sv.lua:20, f.js:8 and @stest1/sv.lua, but everything else that is shown …

GET_ACTIVE_PLAYERS: the replacement for player loops

Just a quick hint: when writing new client-side scripts in Lua/JS (C# already has the Players list doing exactly this), you can loop through players by using the GET_ACTIVE_PLAYERS native. See below for an example of before/after: Before… After… This should be a bit more performant than 256 native invocations, even if no player slot …

Lua support for compile-time Jenkins hashes

In GTA/RAGE games, you’ll often encounter native functions either taking or returning a Jenkins one-at-a-time hash, like the ones returned by GET_HASH_KEY. Traditionally, code would have had to either hardcode hashes (like -1044093321), or use GET_HASH_KEY directly (like GetHashKey(“a_m_y_skater_01”)). This would have lead to either less readability and maintainability, or having to wait for a …

Our work on supporting emoji in Scaleform GFx

In a recent commit to the canary branch, we’ve added support for embedding standard emoji in nearly all cases where text is rendered by Scaleform GFx. This post details a bit of the effort that went on behind this, and where future changes may be headed. Where does GTA use Scaleform GFx? You might already …