{"id":13712312,"url":"https://github.com/nitanmarcel/ScriptHookVZig","last_synced_at":"2025-05-06T21:33:51.406Z","repository":{"id":243943863,"uuid":"813844262","full_name":"nitanmarcel/ScriptHookVZig","owner":"nitanmarcel","description":"Write GTA V mods using Zig","archived":false,"fork":false,"pushed_at":"2024-06-15T18:02:05.000Z","size":7118,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"devel","last_synced_at":"2025-04-30T19:52:57.817Z","etag":null,"topics":["gta5","gtamodding","scripthookv","zig"],"latest_commit_sha":null,"homepage":"https://nitanmarcel.github.io/ScriptHookVZig/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nitanmarcel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-11T21:18:50.000Z","updated_at":"2025-03-24T07:04:16.000Z","dependencies_parsed_at":"2024-11-14T00:15:24.396Z","dependency_job_id":null,"html_url":"https://github.com/nitanmarcel/ScriptHookVZig","commit_stats":null,"previous_names":["nitanmarcel/scripthookvzig"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitanmarcel%2FScriptHookVZig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitanmarcel%2FScriptHookVZig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitanmarcel%2FScriptHookVZig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitanmarcel%2FScriptHookVZig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nitanmarcel","download_url":"https://codeload.github.com/nitanmarcel/ScriptHookVZig/tar.gz/refs/heads/devel","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252772557,"owners_count":21801942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gta5","gtamodding","scripthookv","zig"],"created_at":"2024-08-02T23:01:17.020Z","updated_at":"2025-05-06T21:33:49.836Z","avatar_url":"https://github.com/nitanmarcel.png","language":"Zig","readme":"# ScriptHookVZig\nDevelop GTA V mods with the help of Zig\n\n- [ScriptHookVZig](#scripthookvzig)\n  - [Requirements](#requirements)\n  - [Usage](#usage)\n    - [Adding to build.zig.zon](#adding-to-buildzigzon)\n    - [Adding to build.zig](#adding-to-buildzig)\n    - [Your first script](#your-first-script)\n  - [Documentation](#documentation)\n  - [Thanks](#thanks)\n  - [LICENSE](#license)\n\n## Requirements\n\n- Zig 0.12.0=\u003e\n- [ScriptHookV v1.0.3179.0](http://www.dev-c.com/gtav/scripthookv/) and it's [requirements](https://gtaforums.com/topic/932648-script-hook-v/)\n\n## Usage\n\n### Adding to build.zig.zon\n\n```zig\nzig fetch git+https://github.com/nitanmarcel/ScriptHookVZig#{LastCommitHash} -- save\n```\n\n### Adding to build.zig\n\n```zig\n    // Shared/Dynamic library is required\n    const lib = b.addSharedLibrary(.{\n        .name = \"{name}\",\n        .root_source_file = b.path(\"src/root.zig\"),\n        .target = target,\n        .optimize = optimize,\n    });\n\n    // Add ScriptHookVZig as a dependency\n    const shvz_dep = b.dependency(\"shvz\", .{});\n\n    // Import is as a module\n    lib.root_module.addImport(\"shvz\", shvz_dep.module(\"shvz\"));\n\n    // Save the dll\n    b.installArtifact(lib);\n    // Copy bin/{name}.dll (zig-0.13.0 and above) / lib/{name}.dll (zig-0.12.0) to the GTA root folder where ScriptHookV.dll is located and rename the library extension to .asi: {name}.dll -\u003e {name}.asi\n```\n\n### Your first script\n\n```zig\n// import the module\nconst shvz = @import(\"shvz\");\n\n// Create the script main function\npub export fn scriptMain() void {}\n\npub const DLL_PROCESS_ATTACH: std.os.windows.DWORD = 1;\npub const DLL_THREAD_ATTACH: std.os.windows.DWORD = 2;\npub const DLL_THREAD_DETACH: std.os.windows.DWORD = 3;\npub const DLL_PROCESS_DETACH: std.os.windows.DWORD = 4;\n\n/// Main entry point. Will be loaded by ScriptHookV.dll\npub fn DllMain(hInstance: std.os.windows.HINSTANCE, reason: std.os.windows.DWORD, lpReserved: std.os.windows.LPVOID) std.os.windows.BOOL {\n    _ = lpReserved;\n\n    switch (reason) {\n        DLL_PROCESS_ATTACH =\u003e {\n            // shvz.init() REQUIRED\n            // It handles opening the ScriptHookV.dll library and read symbols from it\n            shvz.init() catch |e| { };\n            // register the script's entry point\n            shvz.main.scriptRegister(hInstance, scriptMain);\n        },\n        DLL_PROCESS_DETACH =\u003e {\n            // Unregister the script's entry point\n            // Call this before shvz.deInit() to ensure taht we didn't unloaded ScriptHookV.dll library.\n            shvz.main.scriptUnregister(scriptMain);\n            // call shvz.deInit() REQUIRED\n            // Will close the loaded ScriptHookV.dll library freeing memory\n            shvz.deinit();\n        },\n        else =\u003e {},\n    }\n\n    return std.os.windows.TRUE;\n}\n```\n\n## Documentation\n\n- You can find a set of examples (C) and a readme in the [ScriptHookV SDK](http://www.dev-c.com/gtav/scripthookv/) archive and help on [gtaforums](https://gtaforums.com).\n- Natives are documented on [Github Pages](https://nitanmarcel.github.io/ScriptHookVZig/#natives.natives)\n- The example project in here only showcases the setup for this respective zig library.\n\n## Thanks\n\n- [Alexander Blade - Script Hook V](http://www.dev-c.com).\n- Discord Zig - For guiding me with some things.\n- [c2z](https://github.com/lassade/c2z/) - Helped in the translation of over 6000 native methods from ScriptHookV sdk.\n- [alloc8or](https://github.com/alloc8or/gta5-nativedb-data) - Most of the native methods are pulled from his [gta5-nativedb-data repo](https://github.com/alloc8or/gta5-nativedb-data/blob/master/natives.json)\n## LICENSE\n\n- MIT\n","funding_links":[],"categories":["Multimedia \u0026 Graphics"],"sub_categories":["Game Development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitanmarcel%2FScriptHookVZig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitanmarcel%2FScriptHookVZig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitanmarcel%2FScriptHookVZig/lists"}