[Cs:s] Insta Bomb Defuse

Please post any questions about developing your plugin here. Please use the search function before posting!
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

[Cs:s] Insta Bomb Defuse

Postby cssbestrpg » Tue Jun 14, 2022 8:26 am

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [Cs:s] Insta Bomb Defuse

Postby satoon101 » Tue Jun 14, 2022 4:03 pm

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
Image
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [Cs:s] Insta Bomb Defuse

Postby cssbestrpg » Tue Jun 14, 2022 4:27 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 35 guests