PDA

View Full Version : [TF2]drop intel when taking damage


no0bifier
05-16-2009, 03:40
basically the idea is that a player will drop intel when damage is taken (and if possible be stunned eg the sandman for 0.5 seconds).

purpose is to use it for a soccer style map, combining only melee weapons, throw intel and this cvar. So i need scouts hitting the other with a bat to cause the player hit to drop the intel and stun for 0.5 seconds(time doesnt really matter, just 0.5 seconds minimum, 2 max) only if they had the intel, otherwise no stun. If a stun is too hard then just dropping on a melee hit would be awesome.

I have done some coding in C before (but none for sourcemod) so if someone could point me in the general direction(or make this code) that would be awesome.

MikeJS
05-16-2009, 05:56
Look at sm_freeze for the stunning and you can use FakeClientCommand(client, "dropitem") to force someone to drop the intel.

http://wiki.alliedmods.net/Main_Page and http://docs.sourcemod.net/api/ are helpful to look at.

no0bifier
05-16-2009, 12:36
would it be possible to see some example code of how the fakeclientcommand would work (fairly new as to how to enter a client)
- after looking at the links you gave it has helped but i still am not sure how to take the "victim" and get the client number etc. off them.

looking at some code i saw this, but still having some problems with how to get the userid/event to change as needed..

new victim = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));

and i dont think sm_freeze is what i am looking for, the idea is for them not to be able to attack the person as well, seeing as freeze still allows you to use melee iirc.