WEAPON_X | Date: Monday, 05.03.2012, 06:53 | Message # 1 |
Group: User
Messages: 12
Status: Offline
| edit: ops i fixed previously i mixed 'item' and 'ent', i like to use 'item' but seems more proper to use 'ent' as in sdk Hi,
My friend suggested a plugin that allows players to place bounty on other players. What I was most concerned with was, how will i keep track of kills.
I thought, there must a nice way, otherwise i would have to go by the printed obituary i.e "Padawan was detonated by WEAPON_X"... but then I found the better way.
When a player is killed, the game creates a temporary entity that is broadcasted to clients and it has all the information about the kill. Since all temporary entities go through LinkEntity() i thought I was finished. However it turns out the data is set after LinkEntity().
finally, i decided to try by checking at Unlinkentity(). So by checking unlinkentity you can get who was killed, by who and how. bellow is example:
In JASS_Syscall(int cmd, int arg0 .....)
if (cmd == G_UNLINKENTITY) { gentity_t* ent = (gentity_t*)arg0; if (!strncmp(ent->classname, "tempEntity", 10)){ if (ent->s.eType == 111) // 111 = an kill broadcast entity { // here you can grab the data, see bellow for where the data is located } } }
according to sdk this is where the data would be found is
method of death : ent->s.eventParm the person who died: ent->s.otherEntityNum the killer: ent->s.otherEntityNum2
good luck! You can use this make server killtracker or for bountys
Message edited by WEAPON_X - Wednesday, 07.03.2012, 02:50 |
|
| |
BufferOverflow | Date: Monday, 05.03.2012, 15:54 | Message # 2 |
Group: Developer
Messages: 47
Status: Offline
| WEAPON_X, hm, that's good information. I was thinking about killtracker plugin, but I'm a bit lazy, so I've discontinued any attempts in start. Maybe, I'll make an alpha-version in weekend.
|
|
| |
junkofmilo | Date: Tuesday, 05.05.2020, 08:05 | Message # 3 |
Group: User
Messages: 4
Status: Offline
| this is great too
|
|
| |