Raised This Month: $12 Target: $400
 3% 

Simulate HS kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-01-2015 , 12:12   Simulate HS kill
Reply With Quote #1

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...
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
bat
Veteran Member
Join Date: Jul 2012
Old 01-01-2015 , 12:35   Re: Simulate HS kill
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=830
I don't know, if it will help you
__________________
bat is offline
Send a message via Skype™ to bat
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-01-2015 , 12:43   Re: Simulate HS kill
Reply With Quote #3

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.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-01-2015 , 12:46   Re: Simulate HS kill
Reply With Quote #4

Maybe by sending a DeathMsg message? https://wiki.alliedmods.net/Half-Lif...Counter-Strike
__________________
HamletEagle is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-01-2015 , 12:49   Re: Simulate HS kill
Reply With Quote #5

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?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-01-2015 , 16:51   Re: Simulate HS kill
Reply With Quote #6

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()!

Last edited by klippy; 01-01-2015 at 16:52. Reason: typo
klippy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-01-2015 , 18:26   Re: Simulate HS kill
Reply With Quote #7

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
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:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("Insta Deagle HS""1.0""Flicker")
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_deagle""onPrimaryAttack"true)
}

public 
onPrimaryAttack(ent)
{
    new 
id pev(entpev_owner)
    new 
iTeam get_user_team(id)
    new 
clipammo
    get_user_weapon
(idclipammo)
    
    if(!
clip)    return
    
    new 
szTeam[32]
    
copy(szTeamcharsmax(szTeam), iTeam == "CT" "TERRORIST")
    
    new 
ptr create_tr2()
    
set_tr2(ptrTR_iHitgroupHIT_HEAD)
    new 
Float:flDirection[3]
            
    new 
players[32], num
    get_players
(playersnum"aeh"szTeam)
    
    for(new 
inumi++)
    {
        
ExecuteHamB(Ham_TraceAttackplayers[i], id147.0flDirectionptrDMG_NEVERGIB DMG_BULLET)
    }
    
    
free_tr2(ptr)

__________________

Last edited by Flick3rR; 01-01-2015 at 18:26.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-01-2015 , 18:47   Re: Simulate HS kill
Reply With Quote #8

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.

Last edited by klippy; 01-01-2015 at 18:47.
klippy is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-01-2015 , 19:15   Re: Simulate HS kill
Reply With Quote #9

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:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

public plugin_init()
{
    
register_plugin("Insta Deagle HS""1.0""Flicker")
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_deagle""onPrimaryAttack"true)
}

public 
onPrimaryAttack(ent)
{
    new 
id pev(entpev_owner)
    new 
iTeam get_user_team(id)
    new 
clip get_pdata_int(ent514// cs_get_weapon_ammo(get_pdata_cbase(id, 373))
    
    
if(!clip)    return
    
    new 
szTeam[15]
    
copy(szTeamcharsmax(szTeam), iTeam == "CT" "TERRORIST")
    
    new 
ptr create_tr2()
    
set_tr2(ptrTR_iHitgroupHIT_HEAD)
    new 
Float:flDirection[3]
            
    new 
players[32], num
    get_players
(playersnum"aeh"szTeam)
    new 
iNum num num 6
    
    
for(new iiNumi++)
    {
        
set_tr2(ptrTR_pHitplayers[i])
        
ExecuteHam(Ham_TraceAttackplayers[i], id147.0flDirectionptrDMG_NEVERGIB DMG_BULLET)
        
client_print(idprint_chat"Executed! %d / %d"i+1iNum)
    }
    
    
free_tr2(ptr)

And here is some image for the results:
Therefore it's something from the trie. Any suggestions anyone?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 01-02-2015 , 03:53   Re: Simulate HS kill
Reply With Quote #10

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.
RateX is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode