PDA

View Full Version : SourceMod: Player Hurt...



Scuzzy
1st January 2009, 14:47
Been trying to pull the weapon name from the player hurt event for Hidden:Source, doesn't seem to work. Is this spelled differently for the mod or not reported?

GetEventString(event, "weapon", weapon, sizeof(weapon));

Scuzzy

Sniper
1st January 2009, 18:29
http://www.eventscripts.com/pages/Player_hurt

That might help you.

Paegus
1st January 2009, 18:46
the event doesn't transmit the weapon name on player_hurt, only player_death. eventscripts' event vars is just checking the player's active weapon and getting the classname.

so on player_hurt you'd just... GetClientName(client, szWeapon, sizeof(...)); or perhaps something more complicated if the needed offsets aren't available for that function (i recall having trouble with it). basically check the player's hLastWeapon property and find out the classname.

though for things like the 303 the weapon can change before the attack is made, such as with the DOT where the guy is holding a pistol... which is why when you switch to pistol after 303ing someone, they can die from the wrong gun. ES will also report the wrong weapon. fortunately you can use the damage done for that. the other guns are all instant-hit so... that leaves the hidden's grenade but the knife can't do 45.334522 damage and the likelihood of doing 37.000000 with a grenade is remote at best.