Hi there everyone!
I am working on my Warcraft-Source server and I started using this version instead of the SourceMod War3Source mod.
I am not very good at Source-Python but I was wondering if someone maybe could make some commands that will make it possible to make a player unkillable for a few seconds, so the player will only drop down to 1 health, but be impossible to kill, is this something that can be made?
All other Source.Python topics and issues.
2 posts • Page 1 of 1
This code below didn't have cooldown or anything else. Make this for urself. I'm making WCS based on skills (WCSSKills), instead of races.
Syntax: Select all
from messages import SayText2 as ST2
from commands.typed import TypedSayCommand
from commands import CommandReturn
from entities import TakeDamageInfo
from entities.hooks import EntityPreHook, EntityCondition
from entities.entity import Entity
from listeners.tick import Delay
# Set, that contains players with active god
god_set = set()
""" Take damage hook """
# Getting TameDamageInfo
info = TakeDamageInfo._obj(args)
# Getting player from pointer arg
player = Entity._obj(args)
# Abort if player not in active god set
if player not in god_set: return
# This hurt kills target?
if info.damage > player.health:
# Making dmg to leave 1 hp
# Change 1, if u want to leave more hp
info.damage = player.health-1
# Getting calling player index
player = Entity(comm.index)
# Adding player to the active god set
# Notifying player
ST2("\4[WCS]\1 You have activated god for \5 3 seconds\1").send(player.index)
# Delay deactivate
Delay(3, god_set.remove, args=(player,))
# Block command from chat (won't appear in chat)
# If u want to show, delete this line
Who is online
Users browsing this forum: No registered users and 4 guests