Jetpack with timer

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Jetpack with timer

Postby Kami » Sun Dec 27, 2015 6:32 pm

Hey guys, I've run into a strange error.

So I tried using player.set_jetpack and after 5 seconds removing it with this line:

Code: Select all

timer_jet = tick_delays.delay(5, player.set_jetpack(0))


Now with that line I get an error from the tick.py saying "NoneType object is not callable"-

Other timers worked just fine, like:

Code: Select all

timer_entity = tick_delays.delay(5, entity.remove)


Any thoughts? Thanks :)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Dec 27, 2015 6:38 pm

You are passing the argument directly to the function at runtime when you need to pass it to the delay instead:

Syntax: Select all

timer_jet = tick_delays.delay(5, player.set_jetpack, 0)


Also, when posting Python code, use the Python syntax blocks: [python][/python]
Image
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Mon Dec 28, 2015 11:46 am

I have added a sanity check, so a descriptive error will be already raised when you create the delay.
https://github.com/Source-Python-Dev-Team/Source.Python/commit/5918ba1bf989cc56e822dc1bc09ec81aa354b126
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Postby Kami » Tue Dec 29, 2015 2:35 pm

Thank you very much satoon, this really helped me out a lot! :)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 121 guests