One Shot One Kill v3.4

Release your plugins here!
SeriousKillerNaruto
Junior Member
Posts: 1
Joined: Mon May 13, 2013 5:10 pm

One Shot One Kill v3.4

Postby SeriousKillerNaruto » Tue Nov 18, 2014 10:37 pm

One Shot One Kill v3.4
Posted by: SeriousKillerNaruto at 2014-11-18 23:37.

Requirements:Description:
One hit is enough to kill you. Converted from eventscripts to source-python.
Download:
Image http://forums.sourcepython.com/attachment.php?attachmentid=116&stc=1&d=1416355316
Installation:
extract it in cstrike/csgo folder and then type in autoexec.cfg :

Code: Select all

sp load oneshotonekill

Version Notes:
  • v1.0:
    --------------

    functions: if you get hurt you die

  • v1.1:
    --------------

    fixed: healthadd removed

  • v2.0:
    --------------

    the addon is now in python

  • v2.1:
    --------------

    fix: damage command works now

  • v2.2:
    --------------

    fix: damage taken by world can't kill you in one hit as shot does

  • v3.0:
    --------------

    addon completely rewritten
    players have 0 hp and when they fall a prehook check the fall velocity so they dont die falling from too high
    added a command to set fall damage : osok_falldamage

  • v3.1:
    --------------

    moved back to damage command
    added corelib's damage modification made by l'in20cible

  • v3.2:
    --------------

    converted to source-python addon

  • v3.3:
    --------------

    fixed few old imports
    added url to this forum post in info.url

  • v3.4:
    --------------

    fixed a mistake in the code (silly me ...)
Attachments
oneshotonekill_v3.4.zip
(1.73 KiB) Downloaded 484 times
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Nov 25, 2014 8:46 pm

Very nice :)

I do have to say, though, that the best way to accomplish this is to hook OnTakeDamage and modify the TakeDamageInfo instance's 'damage' attribute to a high enough number to kill the player. This might not 'currently' work, but will fairly soon (in the entities_changes branch):

Syntax: Select all

from basetypes import TakeDamageInfo
from engines.server import engine_server
from entities.helpers import index_from_edict
from filters.players import PlayerIter
from memory import make_object
from memory.hooks import PreHook
from players.bot import BotManager
from players.entity import PlayerEntity

_create_bot = False

for _player in PlayerIter(return_types='player'):
break
else:
_create_bot = True
edict = BotManager.create_bot('test_bot')
index = index_from_edict(edict)
_player = PlayerEntity(index)


@PreHook(_player.on_take_damage)
def pre_take_damage(args):
info = make_object(TakeDamageInfo, args[1])
info.damage = 1000


if _create_bot:
engine_server.server_command('kickid {0}\n'.format(_player.userid))
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Wed Nov 26, 2014 6:44 am

Syntax: Select all

from players.bot import BotManager
Should be:

Syntax: Select all

from players.bots import bot_manager
However, this will crash if the plugin is loaded via the autoexec.cfg as creating an entity is not possible at this time.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: One Shot One Kill v3.4

Postby Painkiller » Sun Feb 12, 2017 4:56 pm

Hello, i have this error in HL2DM.

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
    plugin = self.manager.load(plugin_name)
  File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load
    plugin._load()
  File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
    self.module = import_module(self.import_name)
  File "../addons/source-python/plugins/oneshotonekill/oneshotonekill.py", line 8, in <module>
    from players.entity import PlayerEntity

ImportError: cannot import name 'PlayerEntity'


[SP] Plugin 'oneshotonekill' was unable to be loaded.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: One Shot One Kill v3.4

Postby satoon101 » Tue Feb 14, 2017 8:53 am

This plugin is very old, and there have been a lot of updates to Source.Python since its release. The following should work (though it has no suicide or team checks):

Syntax: Select all

from entities import TakeDamageInfo
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player


@EntityPreHook(EntityCondition.is_bot_player, 'on_take_damage')
@EntityPreHook(EntityCondition.is_human_player, 'on_take_damage')
def _pre_take_damage(stack_data):
player = make_object(Player, stack_data[0])
damage_info = make_object(TakeDamageInfo, stack_data[1])
player.armor = 0
damage_info.damage = player.health * 2
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: One Shot One Kill v3.4

Postby Painkiller » Tue Feb 14, 2017 6:44 pm

For the moment works wonderful, thank you.

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 32 guests