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

[TF2 (or maybe anything else)] How to effectively kill player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2018 , 16:04   [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #1

Hi, I'm currently writing a SourceMod plugin for Team Fortress 2 based around a custom game mode, and I need a way to kill a player. Currently I've been using
Code:
SlapPlayer(client, 10000);
however that has several problems and side effects such as the slap noise and sometimes not even working (leaves the player at one health). There isn't any
Code:
SlayPlayer()
and Google has not been of any help. Anyone know how to accomplish this? Sorry if it's been super obvious, I am new to SourceMod.
Naleksuh is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 12-09-2018 , 16:07   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #2

Code:
SDKHooks_TakeDamage(int entity, int inflictor, int attacker, float damage, int damageType, int weapon, const float damageForce[3], const float damagePosition[3])
Besides sending the kill command to the player, this is probably your best bet.
Drixevel is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2018 , 16:11   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #3

Looks messy and intimidating to me . Would it be easier to just "send kill command to player"? And is there any known way to bypass that? If not, what needs to be changed to use your way?
Naleksuh is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 12-09-2018 , 16:28   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #4

You just need to fillout the 4 first arguments. The others are optional. Also check the API if you need more info about what each parameter does.
xerox8521 is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 12-09-2018 , 16:29   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #5

Code:
SDKHooks_TakeDamage(client, 0, 0, 99999.0);
Code:
FakeClientCommand(client, "kill");
FakeClientCommand(client, "explode");
I usually use the sdkhooks method so OnTakeDamage is fired.
Drixevel is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2018 , 16:56   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #6

OnTakeDamage doesn't matter to me (not offense), what I'd like to find out is: Is there any way to bypass the FakeClientCommand? Like, cheaters with hacked clients? Or is it fully server side and can't be bypassed? Because if it can not be bypassed, I'd like to use that
Naleksuh is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-09-2018 , 16:58   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #7

Also, xerox, it does not matter to me *how* the client dies, just that they do.
Naleksuh is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 12-09-2018 , 17:59   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #8

Quote:
Originally Posted by Naleksuh View Post
OnTakeDamage doesn't matter to me (not offense), what I'd like to find out is: Is there any way to bypass the FakeClientCommand? Like, cheaters with hacked clients? Or is it fully server side and can't be bypassed? Because if it can not be bypassed, I'd like to use that
None taken, just opens up less avenues while coding later. FakeClientCommand as-is doesn't open up anything bad.
Drixevel is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 12-09-2018 , 20:12   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #9

If you peek inside SourceMod base plugins, sm_slay


https://sm.alliedmods.net/new-api/sd...ePlayerSuicide
__________________
Do not Private Message @me
Bacardi is offline
Naleksuh
Member
Join Date: Dec 2018
Old 12-10-2018 , 03:23   Re: [TF2 (or maybe anything else)] How to effectively kill player
Reply With Quote #10

Quote:
Originally Posted by Drixevel View Post
Code:
SDKHooks_TakeDamage(client, 0, 0, 99999.0);
Code:
FakeClientCommand(client, "kill");
I tried both of these, they did not work. I have sdkhooks included...any other reason they might be failing?
Naleksuh 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 19:59.


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