Releases: Sreyas-Sreelal/omprs-gdk
2.1.0
v2.0.0
New discord server for omprs is available here:
https://discord.gg/jWpVUVqCuj
What's Changed
- Fix StringView::get_data crash by @0xFFFFFFFFFFFFFFFFFF in #7
- Fix destroying vehicles by @0xFFFFFFFFFFFFFFFFFF in #8
- Get rid of undefined behaviour by @0xFFFFFFFFFFFFFFFFFF in #9
- Expose IsPlayerUsingOmp by @0xFFFFFFFFFFFFFFFFFF in #10
- New SDK using open.mp Capi by @Sreyas-Sreelal in #3
New Contributors
- @0xFFFFFFFFFFFFFFFFFF made their first contribution in #7
Full Changelog: 1.1.0...v2.0.0
1.1.0
What's Changed
- add
get_idandget_from_idmethods forGangzones - fix: NetworkStats: use the correct types to reflect open.mp's struct by @ZantetsukenGT in #2
New Contributors
- @ZantetsukenGT made their first contribution in #2
Full Changelog: 1.0.1...1.1.0
1.0.1
Exposed some of the structs fields to be public
Full Changelog: 1.0.0...1.0.1
1.0.0
-
(fixes #1) Removed following
Playermethods:net_stats__bytes_receivednet_stats__bytes_sentnet_stats__connection_statusnet_stats__get_connected_timenet_stats__get_ip_portnet_stats__messages_receivednet_stats__messages_recv_per_secondnet_stats__messages_sentnet_stats__packet_loss_percent
-
Added new
Playermethods:get_net_stats- returns NetworkStats objectnet_stats_get_ip_port- returns a NetworkID object
-
Now
register!macro can be used on multiple objects, works similar to hooks in PAWN. The order of execution of events/callbacks in each "module" depends on the order in whichregister!is called and the return value of last executed callback is considered to be the final, unless this chain is terminated usingterminate_event!macro.
use omp::{events::Events, main, register, terminate_event, types::colour::Colour};
struct MyGreeterModule;
impl Events for MyGreeterModule {
fn on_player_connect(&mut self, player: omp::players::Player) {
player.send_client_message(Colour::from_rgba(0xFF000000), "Greetings Player");
}
fn on_player_text(&mut self, player: omp::players::Player, message: String) -> bool {
if message.contains("badword") {
terminate_event!(false);
}
true
}
}
struct MyMainGamemode;
impl Events for MyMainGamemode {
fn on_player_connect(&mut self, player: omp::players::Player) {
player.send_client_message(
Colour::from_rgba(0x00FF0000),
&format!("Player {} connected!!!", player.get_name()),
);
}
fn on_player_text(&mut self, player: omp::players::Player, message: String) -> bool {
true
}
}
#[main]
fn entry() {
register!(MyGreeterModule);
register!(MyMainGamemode);
}0.2.0
Full Changelog: 0.1.0...0.2.0
0.1.0
First Release of OMPRS
Writing my first gamemode in Rust
-
Download the omprs component from here
-
Place the
Rust.dllorRust.socomponent incomponentsfolder -
Create a new rust project
cargo new mygm --lib -
Add
ompto dependecies
cargo add omp -
Add this to your
Cargo.toml[lib] crate-type = ["cdylib"]
-
Write a basic code like this
use omp::{events::Events, main, register, types::colour::Colour}; struct MyGM; impl Events for MyGM { fn on_player_connect(&mut self, player: omp::players::Player) { player.send_client_message(Colour::from_rgba(0xFFFFFFFF), "Welcome to my server!"); } } #[main] pub fn game_main() { register!(MyGM); }
-
Build the gamemode
cargo +stable-i686 build -
Put the compile
mygm.dllormygm.sotogamemodesfolder -
Goto
config.jsonadd following to it"rust":{ "gamemode":"mygm", }
-
Run your server