Welcome, Guest. Please login or register.
Did you miss your activation email?
October 23, 2014, 05:50:52 am
Home Help Login Register
News: Zombie Master 2

Zombie Master  |  Zombie Master  |  Servers and Hosting  |  Topic: ZM Game Events for server plugins « previous next »
Pages: [1]
Author Topic: ZM Game Events for server plugins  (Read 8039 times)
Bad King Urgrain
Administrator
*****
Posts: 12744



« on: January 10, 2009, 07:06:07 pm »

ZM has a couple of special or customised game events that server plugins can use to easily track what's going on in the game. You can find the specifications in the file "/zombie_master/resources/modevents.res", and in this post I'll outline the basics as well.

Game status-related events

round_restart
Data:
None.

Notes:
Simply an event thrown when a roundrestart begins.

round_victory
Data:
- humans_won (boolean): true if the survivor team won, false if the ZM won.
- cause (string): the cause of the victory, any of the following that should speak for themselves: "humans_dead", "objective", "zm_submitted"

player_got_points
Data:
- player (number): user ID of the player that got points
- points (number): how much points he got
- score_ent (number): entity index of the score-giving entity (eg. a game_score entity)


Player-related events

player_death
Data:
- userid (number): user ID of the player who died.
- attacker (number): user ID of the player who killed him, if any.
- weapon (string): name of the weapon used to kill the player, or name of the zombie if it was a zombie kill. This behaviour is most likely obsolete due to the addition of "z_id" in 1.2.
- zombie (boolean): true if the player was killed by a zombie.
- z_id (number): zombie entity index, if the player was killed by a zombie, else it's 0

Notes:
Behaves similar to the HL2DM event, but with additions/changes for zombie kills.
The behaviours of player_hurt and player_death may be a bit confusing, sorry about that.

player_hurt
Data:
- userid (number): user ID of the player who was hurt.
- attacker (number): user ID of the player who hurt him, OR entity index of zombie who hurt him.
- health (number): health remaining.
- zombie (boolean): true if damage was caused by a zombie. If true, "attacker" is a zombie entity index.

Note: see player_death notes.

triggered_manipulate
Data:
- entindex (number): entity index of the manipulate that was triggered.

Note:
Event is generated when the ZM activates a manipulate, or it is triggered by a trap.

Zombie-related events

zombie_death
Data:
- type (string): entity name of the zombie that died
- attacker (number): user ID of the killer, which is the ZM if the zombie was deleted by him
- damage (number): damage done in the attack that killed the zombie, can identify headshots with this
- weapon (string): weapon used to kill the zombie
- z_id (number): zombie entity index

zombie_spawn
Data:
- type (string): entity name of zombie
- z_id (number): zombie entity index

Note: note that the zombie's entity index is in many of the events that involve a zombie. You might be able to use this to track a zombie over his lifetime. Note that entity indices are reused after an entity is destroyed.

zombie_hurt
Data:
- See zombie_death. Basically the same, just replace "killer" with "attacker".

m4x
Poster

Posts: 161



« Reply #1 on: January 23, 2009, 10:34:28 pm »

Thanks for the thread.

Bunny, what is the variable which stores the points of each player?

is it m_iScore  in CPlayerResource  ?

Or is there a simple way to add points to a player? A command to run? Otherwise I am going to try to read values of the m_iScore and to rise it.


Thx
« Last Edit: January 23, 2009, 10:46:30 pm by m4x »

Bad King Urgrain
Administrator
*****
Posts: 12744



« Reply #2 on: January 23, 2009, 10:43:26 pm »

I believe so, yes.
m4x
Poster

Posts: 161



« Reply #3 on: January 23, 2009, 11:05:54 pm »

It seems that the player_death event is fired twice. A message to user is delivered twice in the moment of death, at least on my server.

For now I am trying the CPlayerResource.m_iScore.000  -  CPlayerResource.m_iScore.032 without effect.

anyway, thx for your time still spending on forums, bunny.

Bad King Urgrain
Administrator
*****
Posts: 12744



« Reply #4 on: January 23, 2009, 11:44:48 pm »

player_death is the only event that all clients attach a listener for, in order to display deaths in the top right of the screen. Perhaps that makes it fire twice. The player_death firing-related code is unchanged from how it comes with the Source SDK, only some of the event's contents have been modified.

I really have no idea how server plugins do things, so that stuff doesn't mean that much to me. Of course I know what CPlayerResource is in the code, but I don't know how the server plugins interact with it. I assume the number at the end is an index, as CPlayerResource's m_iScore is an array. The values sent over the network through CPlayerResource are used by clients in the scoreboard, so it definitely has to be in there somewhere.

Is there some sort of scanning process involved in finding what variables can be tracked, with results I could take a look at, or is the CPlayerResource stuff simply easy to access because other Source games use it as well (and therefore it might be well documented)?
m4x
Poster

Posts: 161



« Reply #5 on: January 24, 2009, 12:16:11 am »

There is for example
es est_GetKills temp event_var(userid)
command in ES_Tools. It works great in CSS. SourceSDK probably uses another way.

i can easily access CBasePlayer.localdata.m_iAmmo.013  (its revolver ammo) of the given player.
Problem for me could be in the fact that score is not in   CBasePlayer.localdata (relative to every player) but in the array CPlayerResource.

Will have a closer look in it later, now I need to sleep.

good night to you, too.

 

Bad King Urgrain
Administrator
*****
Posts: 12744



« Reply #6 on: January 24, 2009, 09:06:41 am »

Well, CPlayerResource gets the value for m_iScore from CBasePlayer::m_iFrags, but I don't know if you can access that. You may not be getting results from modifying CPlayerResource::m_iScore because it is overwritten with that m_iFrags value every 0.1 seconds.

It would be easier if server plugins let you call functions directly. Just calling CBasePlayer::IncrementFragCount would be nice.
« Last Edit: January 24, 2009, 09:08:14 am by theGreenBunny »
m4x
Poster

Posts: 161



« Reply #7 on: January 24, 2009, 12:27:24 pm »

the CBasePlayer::m_iFrags is not listed in classes and entities list.  

in eventscript the score works standard like in other games, its just not shown in hlsw frags. Now i saw in game that in the scoretable i am able to do with it whatewer I like.  


it would be good to make the first post as complete as possible, with player_spawn and all other stuff to help beginners.

thx!

Bad King Urgrain
Administrator
*****
Posts: 12744



« Reply #8 on: January 24, 2009, 01:14:34 pm »

The only game events I know anything about are the ones ZM modifies/adds. People are probably better off looking elsewhere for information on standard events.
m4x
Poster

Posts: 161



« Reply #9 on: January 24, 2009, 07:47:39 pm »

ok then. smile
Hope you will let us know about your future projects Wink

+ m4x

Pages: [1]  
Zombie Master  |  Zombie Master  |  Servers and Hosting  |  Topic: ZM Game Events for server plugins « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines
Page created in 0.087 seconds with 20 queries.