Simulate HS kill
Hey guys! I'm currently facing a problem. Which is the best method to simulate HS kill? Let's get for example that I want to put a comand /kill and that will kill a random player from the other team with headshot with the exact weapon, which I'm holding. In simple words, to false th ekill as I've really done it and the player would fall down like really HS killed. That's all, I doubt it will be some hard stuff, but I can't think of it...
|
Re: Simulate HS kill
https://forums.alliedmods.net/showthread.php?t=830
I don't know, if it will help you |
Re: Simulate HS kill
No, no. That's just a fake deathmsg, it's simple. But I want to remake the whole kill, the dying animation, the score info, all of it. Just like it's a real kill.
|
Re: Simulate HS kill
Maybe by sending a DeathMsg message? https://wiki.alliedmods.net/Half-Lif...Counter-Strike
|
Re: Simulate HS kill
That's what bat has already suggested. The deathmsg is just displayed in the corner and calls the event, right? It's not just that, what I'm trying to achieve. I'd want to remake the death animation of a HS kill on the victim, the score info to be immediately updated and all the details of a normal kill, like it was actually done. Is there some way?
|
Re: Simulate HS kill
I am writing this of top of my head right now, and I don't know if it will work, but I would create a new trace handle with create_tr2(), set TR_iHitGroup member of trace handle to HIT_HEAD, then make a ExecuteHam(Ham_TraceAttack, ...) call with that trace handle. And don't forget to free the handle with free_tr2()!
|
Re: Simulate HS kill
Hey, dude, thanks a lot! It worked! I created a simple plugin to test it. It does the following: when you shoot a random shot with a deagle, you kill all the players from the opponent team with HS. There is only one thing bothering me - they all die how they should, but only one guy survives and doesn't give a f*ck about my plugin :D
It's not from the loop, since the 'num' returns 1 (printed it), but the trace doesn't kill the last guy. I mean, they are like 4 CTs, and when I shoot with the deagle, three of them die and the fourth just sirvives like nothing has event ment to kill him. It's strange and I can't understand what is causing that. Here is the code, I think the loops are okay and there is some special detail with the traces, that I'm missing. Some opinions? PHP Code:
|
Re: Simulate HS kill
I really don't know what could it be, try debugging it a little more, make sure it is executed for every player.
also, try setting TR_pHit member for each player. |
Re: Simulate HS kill
Ooookay, that's the current code. With and without TR_pHit it's the same. No error logs. And I've debugged it enough to see, that it's executed on all players, but not all die - the last one stands alive. Here's the test code:
PHP Code:
Therefore it's something from the trie. Any suggestions anyone? |
Re: Simulate HS kill
Don't know what's wrong with it, but Ham_Killed works. Remember to set m_LastHitGroup value to HIT_HEAD and catch DeathMsg, modify weapon string to the weapon you're holding.
|
| All times are GMT -4. The time now is 15:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.