AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Getting details about who killed and dead. using Hamsandwich lib. (https://forums.alliedmods.net/showthread.php?t=85934)

unSeen 02-18-2009 06:16

[HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
Hey everybody,
Before i start with my question, i wanna say SORRY about my English..
It's now me it's the English teachers in my country ;-)

So, i heard about Hamsandwich, and i want to make a plugin that doing something after some one killed.
I so in one of the plugins here, that someone used HamSandwich there,
Something like this:

PHP Code:

public plugin_init()
    
RegisterHam(Ham_Killed"player""death_func"1)
 
public 
death_func(idszKillershouldgib)
{
    new 
a,b,c
    id 
a
    szKiller 
b
    shouldgib 
c
    
....
 
 
    ....


Now I have 2 questions:
1. What the third parameter in the death_func function says? (I have problem on my server so i couldn't check it alone)
2. How can i get the id of the Killer?

And one more thing,
If i want to write each time in the server memory when some one killed somebody, how would i save it if i want to save more then one parameter?
I mean, i want to make something like a table:
PHP Code:

authid   killed   died   
STEAM_X
:X:X 5 2 

And last thing,
How can i check if the death is an headshot?


Thanks,
Elad.

Arkshine 02-18-2009 06:29

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
1. it tells you if player should explode into gibs or not.
2. In you example ; szKiller. Which should be Killer.

unSeen 02-18-2009 06:38

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
You mean the ID of the killer?
(btw thanks alot)

and some one know about 3rd and 4th question?

Arkshine 02-18-2009 06:46

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
Yep.

4. About the headshot, 2 easy ways are :

- if using Ham, you can check the offset 75 (m_LastHitGroup) ; something like : if ( get_pdata_int( id, 75 ) == HIT_HEAD )
- Using the DeathMsg event instead of ham, and cheking the third param.

unSeen 02-18-2009 06:53

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
thanks.

sorry that I anoyne,
My last question, How can i know wich weapon the killer used?

Arkshine 02-18-2009 07:00

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
You can use get_user_attacker().

Code:

new WeaponId, HitZone;
get_user_attacker( id, WeaponId, HitZone );

WeaponId will give you the killer's weapon id ( CSW_* ; see amxconst.inc )
HitZone will give you the last zone which has killed the player, like m_LastHitGroup. ( HIT_* ; see amxconst.inc )

If you use the DeathMsg Event, the killer's weapon name is passed into the fourth param. If you need the weapon id, you can use get_weaonid().

unSeen 02-18-2009 07:07

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
ok thank you alot!
I appraise you'r help!

Arkshine 02-18-2009 07:16

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
Actually, you can use get_user_weapon( Killer ) if you need only to know the weaponid used.

fysiks 02-18-2009 14:17

Re: [HELP] Getting details about who killed and dead. using Hamsandwich lib.
 
The killer id is an integer so you shouldn't use "sz" as this indicates a zero-terminated string; for clarity.


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

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