mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-10-26 14:00:22 +00:00
Update backend_lua.rs
This commit is contained in:
1 parent
4f52e30545
commit
6dee028a88
1 file changed
+3
-2
@@ -51,8 +51,9 @@ impl UserData for Context {
|
|||||||
methods.add_function("GetPlayerCount", |lua, ()| {
|
methods.add_function("GetPlayerCount", |lua, ()| {
|
||||||
let me: Context = lua.globals().get("MP")?;
|
let me: Context = lua.globals().get("MP")?;
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
let r = me.tx.blocking_send(ServerBoundPluginEvent::RequestPlayerCount(tx));
|
if let Err(e) = me.tx.blocking_send(ServerBoundPluginEvent::RequestPlayerCount(tx)) {
|
||||||
debug!("{:?}", r);
|
error!("Failed to send packet: {:?}", e);
|
||||||
|
}
|
||||||
let message = rx.blocking_recv();
|
let message = rx.blocking_recv();
|
||||||
if let Ok(message) = message {
|
if let Ok(message) = message {
|
||||||
if let PluginBoundPluginEvent::PlayerCount(player_count) = message {
|
if let PluginBoundPluginEvent::PlayerCount(player_count) = message {
|
||||||
|
|||||||
Reference in new issue
Block a user