mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Valve Protocol: Players with no name (name length == 0), are no more added to players details
This commit is contained in:
parent
5c664187f9
commit
c5a35016d1
1 changed files with 23 additions and 13 deletions
|
|
@ -366,20 +366,30 @@ impl ValveProtocol {
|
||||||
|
|
||||||
for _ in 0..count {
|
for _ in 0..count {
|
||||||
buffer.move_position_ahead(1); //skip the index byte
|
buffer.move_position_ahead(1); //skip the index byte
|
||||||
|
|
||||||
|
let name = buffer.get_string_utf8()?;
|
||||||
|
let score = buffer.get_u32()?;
|
||||||
|
let duration = buffer.get_f32()?;
|
||||||
|
|
||||||
|
let deaths = match *app == SteamID::TS.as_app() {
|
||||||
|
false => None,
|
||||||
|
true => Some(buffer.get_u32()?)
|
||||||
|
};
|
||||||
|
let money = match *app == SteamID::TS.as_app() {
|
||||||
|
false => None,
|
||||||
|
true => Some(buffer.get_u32()?)
|
||||||
|
};
|
||||||
|
|
||||||
|
if name.len() > 0 {
|
||||||
players.push(ServerPlayer {
|
players.push(ServerPlayer {
|
||||||
name: buffer.get_string_utf8()?,
|
name,
|
||||||
score: buffer.get_u32()?,
|
score,
|
||||||
duration: buffer.get_f32()?,
|
duration,
|
||||||
deaths: match *app == SteamID::TS.as_app() {
|
deaths,
|
||||||
false => None,
|
money
|
||||||
true => Some(buffer.get_u32()?)
|
|
||||||
},
|
|
||||||
money: match *app == SteamID::TS.as_app() {
|
|
||||||
false => None,
|
|
||||||
true => Some(buffer.get_u32()?)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(players)
|
Ok(players)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue