[Cs:s] Insta Bomb Defuse
Posted: Tue Jun 14, 2022 8:26 am
by cssbestrpg
Hi guys, i have issue with my code. I have been trying to make a code when you start defusing the bomb, it immeadily would defuse the bomb, but some reason it doesn't work at all.
Here is the code:
Syntax: Select all
from events import Event
from entities.entity import Entity
@Event('bomb_begindefuse')
def bomb_begindefuse(args):
bomb = Entity.find('planted_c4')
bomb.defuse_count_down = 1.0
Re: [Cs:s] Insta Bomb Defuse
Posted: Tue Jun 14, 2022 4:03 pm
by satoon101
You might have to delay it 1 tick instead of doing it directly in the event:
Syntax: Select all
from events import Event
from entities.entity import Entity
from listeners.tick import Delay
@Event('bomb_begindefuse')
def bomb_begindefuse(game_event):
Delay(0, defuse_bomb)
def defuse_bomb():
bomb = Entity.find('planted_c4')
bomb.defuse_count_down = 1.0
Re: [Cs:s] Insta Bomb Defuse
Posted: Tue Jun 14, 2022 4:27 pm
by cssbestrpg
satoon101 wrote:You might have to delay it 1 tick instead of doing it directly in the event:
Syntax: Select all
from events import Event
from entities.entity import Entity
from listeners.tick import Delay
@Event('bomb_begindefuse')
def bomb_begindefuse(game_event):
Delay(0, defuse_bomb)
def defuse_bomb():
bomb = Entity.find('planted_c4')
bomb.defuse_count_down = 1.0
That did the trick, thanks