Comments (8)
UserIDs certainly don't change throughout the game - are you sure rain didn't disconnect before the game ended?
from demofile.
Hey,
I just now tested further for disconnects:
demoFile.entities.on('beforeremove', e => {
if (e.entity.userInfo) {
console.log('user entity gets removed:');
console.log(e.entity.name, e.entity);
}
});
demoFile.gameEvents.on('client_disconnect', e => {
console.log('a client disconnected');
let testPlayerIds = demoFile.players.map(p => p.userId);
console.log('testPlayerIds', testPlayerIds);
});
while the event client_disconnect
never fires, the beforeremove
shows me that rains entity indeed gets deleted right before the end
event of the demoFile gets fired.
So I am not quite sure how to precede from here.
my goal is to get all actual player Ids (onle the 10 who play and not any players, that spectate or something which demoFile.players.map(p => p.userId);
seems to include)
I tried to look at the e.entity
for the beforeremove
event but I didn't find an ID in there. And since the entity just gets remove I couldn't override my current ID for rain anyhow.
from demofile.
You can check if a player is on a team by checking their team number is 2 or 3. 0 = Unassigned, 1 = Spectator, 2 = Terrorist and 3 = CT.
Also player_disconnect
is the event you're looking for.
If you want to take stats at the end of the game, you can check when the game phase switches to match end:
demo.entities.on('DT_CSGameRules.m_gamePhase', e => {
if (e.newValue == 5) {
// Game finished
}
});
from demofile.
Thank you!
for game events I am using this reference: https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events
and player_disconnect
is not on that reference. Do you have one thats more up to date?
Cheers
from demofile.
from demofile.
Hey,
sadly, DT_CSGameRules.m_gamePhase
doesn't get fired at all when I am listening on demoFile.entities
code block:
demoFile.entities..on('DT_CSGameRules.m_gamePhase', e => {
console.log('TEST', e);
if(e.newValue == 5) {
console.log('TEST 2');
}
});
Cheers
from demofile.
Sorry, that should have been ‘change’ and you should be checking e.tableName
and e.varName
from demofile.
Thanks, that works :-)
from demofile.
Related Issues (20)
- Missed Examples in Documentation HOT 1
- Valve Matchmaking Encrypted Chat HOT 6
- trouble while complie dumpfile.ts HOT 2
- Some Player Stats did not appear
- Illegal offset HOT 2
- error TS2532: Object is possibly 'undefined' HOT 1
- Documentation missing properties HOT 2
- Some demos missing `round_announce_match_start` HOT 3
- Wrong parse streams with transformation HOT 1
- Game event buytime_ended triggers only once HOT 3
- Is it possible to find out the skin of a weapon? HOT 1
- GOTV+ Broadcasting HOT 13
- demo.teams[0] `members` property is always empty HOT 1
- Events not firing
- itemPurchase Event - Cost HOT 1
- ServerRankUpdate doesnt work anymore HOT 3
- Is it possible to get the colors (blue, green, orange, yellow, purple) from players?
- isAlive not always working HOT 1
- Will this work with new Counter Strike 2? HOT 1
- m_iMatchStats_Deaths not sorted properly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from demofile.