![]() |
what happends when game ends?
What hapends when game ends. I should write info about bots and game statistics to spesific file everytime when game ends. So I'm wondering where would be a good place to do this? I should also get my hands on game statistics(deaths,kills..).. so any ideas about that would also be nice.
- NiCo |
Re: what happends when game ends?
When game ends, you mean...
- when the SERVER shuts down (or when the map is changed) ? - when the ROUND restarts (in round-based games such as Counter-Strike ?) For the 1st one, hook the ServerDeactivate() function ; for the second one, it all depends on the way the mod authors implemented their round system. Usually a network message is sent to clients to synchronize the restart. Find this message and hook it. Players frags are usually stored in pEdict->v.frags. It's the common place to store it but note that some mods may decide to store it elsewhere (as about any other variables in there, actually...) Player deaths are usually stored in the entitie's private data (pEdict->pvPrivateData + offset), which you can't access without the mod's source code, or without a bit of reverse-engineering to find out the offset in memory where it is. A more convenient solution is to keep track of these events internally as they occur. |
Re: what happends when game ends?
I was talking about the situation when round restarts in counter-strike. Thanks for usefull info pierre.. Thats just what I needed to know.
- NiCo |
Re: what happends when game ends?
I'm having problems outputting messages. I checked readme.txt from hpb bot wich explains how to do this, but I don't have _DEBUG flag in my sources anywhere.. So where can I put these lines to get message output? (or is it possible to put message output on from console?, that would also help)
Code:
fp=fopen("bot.txt","a"); Here's what I add under else if (mod_id == CSTRIKE_DLL): Code:
else if (msg_type == GET_USER_MSG_ID (PLID, "TextMsg", NULL)) |
Re: what happends when game ends?
for setting such a preprocessor variable like _DEBUG, check your compiler's manual. for gcc it's -D, for MSVS, just go to the property page of your project and then compiler ...
outputting debug messages to the console is normally possible, but not during receiving messages, since you'd produce a new message and HL doesnt really like "recursive" messages :) pfnMsgBegin is some nice function and there are different approaches to variable length message handling. I guess you just have to do some more experimenting. one day isnt much :P and this message you are talking about is one which has multible recipients, I think. Therefore the handling is a bit different. take a close look at it with debug_engine like pierre suggested and it should be fine |
Re: what happends when game ends?
or if you're lazy, look in botman's HPB template since the new CS round check is implemented already 8)
|
Re: what happends when game ends?
It works! Almoust two days gone by without trying to solve this problem. I started again to check what is in the MessageBegin funktion and found out that I had put some lines at wrong place.
- NiCo |
All times are GMT +2. The time now is 13:36. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.