Skip to content

Commit

Permalink
Merge pull request #192 from ymo-4/set_key_value
Browse files Browse the repository at this point in the history
Add set_key_value, clear_all_key_values
  • Loading branch information
Noxime authored Jul 22, 2024
2 parents 0c6ed0a + e2cb548 commit 23283f8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,23 @@ impl Server {
}
}

/// Add/update a rules key/value pair.
pub fn set_key_value(&self, key: &str, value: &str) {
let key = CString::new(key).unwrap();
let value = CString::new(value).unwrap();

unsafe {
sys::SteamAPI_ISteamGameServer_SetKeyValue(self.server, key.as_ptr(), value.as_ptr());
}
}

/// Clears the whole list of key/values that are sent in rules queries.
pub fn clear_all_key_values(&self) {
unsafe {
sys::SteamAPI_ISteamGameServer_ClearAllKeyValues(self.server);
}
}

/// Returns an accessor to the steam UGC interface (steam workshop)
///
/// **For this to work properly, you need to call `UGC::init_for_game_server()`!**
Expand Down

0 comments on commit 23283f8

Please sign in to comment.