HLFX.Ru Forum (https://hlfx.ru/forum/index.php)
- Half-Life SDK (https://hlfx.ru/forum/forumdisplay.php?forumid=8)
-- Problem with frags (https://hlfx.ru/forum/showthread.php?threadid=3000)
Отправлено MisterDeath 14-09-2011 в 22:50:
Problem with frags
Well guys the problem is that what happens is that when I kill a zombie this gives me a point but if I keep shooting the zombie that still gives me point ... until it falls down and gets quiet
Someone fix the code to make it work well?
Sorry bad english...
C++ Source Code:
1 | void CZombie :: Killed( entvars_t *pevAttacker, int iGib ) |
3 | ClientPrint( pevAttacker, HUD_PRINTCENTER, "Killed zombie, you win 1 point!" ); |
5 | CBaseEntity * ep = CBaseEntity:: Instance (pevAttacker); |
6 | CBasePlayer * PK = (CBasePlayer *) ep; |
8 | PK-> AddPoints (1, false); // give one fuck point |
10 | CBaseMonster::Killed( pevAttacker, iGib ); |
__________________
hl 4 ever
Отправлено Ku2zoff 15-09-2011 в 08:31:
MisterDeath try to add checking for deadflag.
C++ Source Code:
1 | void CZombie :: Killed( entvars_t *pevAttacker, int iGib ) |
3 | if (pev->deadflag == DEAD_DEAD) |
or for pev->health level
C++ Source Code:
1 | void CZombie :: Killed( entvars_t *pevAttacker, int iGib ) |
Добавлено 15-09-2011 в 15:31:
I think pev->health checking is right way. If I'm not mistaking, pev->deadflag DEAD_DEAD is installed when the monster's "die" animation is finished.
Отправлено MisterDeath 15-09-2011 в 13:45:
Works but...
points if he continues to follow while giving the animation shooting death
__________________
hl 4 ever
Отправлено Ku2zoff 15-09-2011 в 14:31:
MisterDeath well, try to move your "Point giving" code into another function in CZombie class... HandleAnimEvent maybe? Add new event for "die" animations in zombie's model at frame 1, for example and call your code from HandleAnimEvent. But you'll need to get a killer's edict somehow from that function...
Отправлено MisterDeath 15-09-2011 в 14:36:
i solved, used UTIL_Remove and added bodysplat effect... is other alternative...
__________________
hl 4 ever