Crates.io | scripthookv-rs |
lib.rs | scripthookv-rs |
version | 0.3.0 |
source | src |
created_at | 2021-12-17 17:12:01.027452 |
updated_at | 2022-03-26 17:11:03.904918 |
description | Rust bindings for ScriptHookV |
homepage | https://github.com/DottieDot/ScriptHookV-rs |
repository | https://github.com/DottieDot/ScriptHookV-rs.git |
max_upload_size | |
id | 499688 |
size | 50,258 |
Scripthookv-rs provides Rust bindings for ScriptHookV and GTA 5 natives.
DISCLAIMER: This crate is still in early development and API is subject to change.
This crate contains the raw bindings for ScriptHookV without any wrapping.
Add the following to your cargo.toml
dependencies:
libscripthookv-sys = "0.1.0"
This crate contains a wrapped api for ScriptHookV
Add the following to your cargo.toml
dependencies:
scripthookv-rs = "0.3.0"
once_cell = "1.9.0"
winapi = { version = "0.3.9", features = [ "consoleapi", "winuser", "wincon" ] }
async-trait = "0.1.52"
This crate contains a wrapped api for GTA 5 natives. It should be installed together with the scripthookv-rs
crate.
This crate has not been published yet.
For your entrypoint you can use the shv_entrypoint
macro. This macro generates a DllMain for you.
extern "C" fn script_main() {
loop {
// On tick logic
script_yield();
}
}
#[shv_entrypoint]
fn entrypoint(module: ModuleHandle) -> ScriptHookV {
ScriptHookVBuilder::new(module)
.script(script_main)
.build()
}
Natives can be invoked directly with the native_call
macro like this:
call_native!(Vehicle, 0xAF35D0D2583051B0, adder_hash, coords, heading, false, false, false);
// ^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Return type Native hash Parameters
Alternatively you can use my nativedb to generate wrapping similar to a natives.h
file.
* excluding deprecated functions.
Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.