[HL2:DM] Jet Pack Help

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

[HL2:DM] Jet Pack Help

Postby Painkiller » Sat Oct 08, 2016 1:40 pm

Hello, this plugin does not work with the latest SP version.

Could someone help me to repair? (Look forward to standalone)


Syntax: Select all

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
# Cvars
from cvars.public import PublicConVar
# Plugins
from plugins.info import PluginInfo


# =============================================================================
# >> PLUGIN INFO
# =============================================================================
info = PluginInfo()
info.name = 'jet'
info.author = 'RocKs'
info.version = 'version (Final)'
info.basename = 'Jetpack'
info.variable = info.basename + ' '
info.url = 'http://www.rocks-clan.de'
info.convar = PublicConVar(info.variable, info.version, info.name + ' Version')

from events import Event
from players.entity import Player
from players.helpers import index_from_userid, playerinfo_from_userid, index_from_playerinfo, userid_from_index
from messages import HudMsg, SayText2
from colors import Color
from commands.say import SayCommand
from entities.entity import Entity
from engines.sound import Sound
from filters.recipients import RecipientFilter
from mathlib import Vector
from entities.helpers import create_entity
from entities.helpers import spawn_entity
from listeners.tick import Delay
from stringtables import string_tables
from supermod.supermod import admins, isadmin

has_jet = {}
jet_left = {}

@Event('player_activate')
def _player_activate(game_event):
userid = game_event.get_int('userid')
index = index_from_userid(userid)
steamid = Player(index).steamid
if isadmin(steamid):
has_jet[userid] = 0
jet_left[userid] = 9999
else:
has_jet[userid] = 0
jet_left[userid] = 3

@SayCommand('jet')
def _jet_say_command(command, index, team=None):
player = Player(index)
userid = userid_from_index(index)
player = Player(index)
if has_jet[userid] == 0:
if jet_left[userid] >= 1:
entity = Entity.create('env_smokestack')
entity.set_key_value_int('BaseSpread', 10)
entity.set_key_value_int('EndSize', 5)
entity.set_key_value_int('JetLength', 180)
entity.set_key_value_int('Rate', 40)
entity.set_key_value_int('renderamt', 255)
entity.set_key_value_color('rendercolor', Color(255, 255, 255))
entity.set_key_value_string('SmokeMaterial', 'particle/SmokeStack.vmt')
entity.set_key_value_int('Speed', 60)
entity.set_key_value_int('SpreadSpeed', 5)
entity.set_key_value_int('StartSize', 20)
entity.set_key_value_int('InitialState', 1)
entity.teleport(player.origin, None, None)
entity.spawn()
entity.set_parent(player, player.lookup_attachment('rfoot'))
player.push(0, 200, True)
player.set_jetpack(1)
has_jet[userid] = 1
jet_left[userid] -= 1
steamid = Player(index).steamid
Sound('/ambient/machines/thumper_startup1.wav').play(player.index)
if not isadmin(steamid):
if jet_left[userid] == 0:
SayText2("[Jetpack] Das war dein letztes Jetpack!").send(index)
else:
SayText2("[Jetpack] Du hast noch %s/3 Jetpacks!" % jet_left[userid]).send(index)
else:
SayText2("[Jetpack] Jetpack aktiviert!").send(index)
timer_trail = Delay(5, entity.remove)
timer_jet = Delay(5, player.set_jetpack, 0)
timer_data = Delay(5, remove_timer, userid)
else:
SayText2("[Jetpack] Du hast keine Jetpacks mehr!").send(index)
else:
SayText2("[Jetpack] Du benutzt bereits ein Jetpack!").send(index)

def remove_timer(userid):
has_jet[userid] = 0
index = index_from_userid(userid)
Sound('/ambient/machines/thumper_hit.wav').play(index)


Code: Select all

15:32:53 [SP] Unable to unload plugin 'jet' as it is not currently loaded.
         [SP] Loading plugin 'jet'...
         
         [SP] Caught an Exception:
         Traceback (most recent call last):
           File "../addons/source-python/packages/source-python/plugins/manager.py", line 75, in __missing__
             instance = self.instance(plugin_name, self.base_import)
           File "../addons/source-python/packages/source-python/plugins/instance.py", line 82, in __init__
             self._plugin = import_module(import_name)
           File "../addons/source-python/plugins/jet/jet.py", line 33, in <module>
             from entities.helpers import create_entity
         
         ImportError: cannot import name 'create_entity'
         
         
         [SP] Plugin 'jet' was unable to be loaded.



Thanks in Advance
User avatar
satoon101
Project Leader
Posts: 2319
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Jet Pack Help

Postby satoon101 » Sat Oct 08, 2016 3:18 pm

I haven't tested this, but I cleaned up the plugin a bit and removed imports that no longer exist (like create_entity, which fixes the error).

Syntax: Select all

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
from cvars.public import PublicConVar
from events import Event
from messages import SayText2
from colors import WHITE
from commands.say import SayCommand
from entities.entity import Entity
from engines.sound import Sound
from listeners.tick import Delay
from players.entity import Player
from players.helpers import index_from_userid
from plugins.info import PluginInfo
from filters.players import PlayerIter


# =============================================================================
# >> PLUGIN INFO
# =============================================================================
info = PluginInfo()
info.name = 'jet'
info.author = 'RocKs'
info.version = 'version (Final)'
info.basename = 'Jetpack'
info.variable = info.basename + ' '
info.url = 'http://www.rocks-clan.de'
info.convar = PublicConVar(info.variable, info.version, info.name + ' Version')


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
has_jet = {}
jet_left = {}


# =============================================================================
# >> GAME EVENTS
# =============================================================================
@Event('player_activate')
def _player_activate(game_event):
player = Player.from_userid(game_event['userid'])
init_dicts(player)


# =============================================================================
# >> COMMANDS
# =============================================================================
@SayCommand('jet')
def _jet_say_command(command, index, team=None):
player = Player(index)
if has_jet[player.userid]:
SayText2("[Jetpack] Du benutzt bereits ein Jetpack!").send(index)
return

if not jet_left[player.userid]:
SayText2("[Jetpack] Du hast keine Jetpacks mehr!").send(index)
return

entity = Entity.create('env_smokestack')
entity.base_spread = 10
entity.end_size = 5
entity.jet_length = 180
entity.rate = 40
entity.color = WHITE
entity.set_key_value_string('SmokeMaterial', 'particle/SmokeStack.vmt')
entity.speed = 60
entity.spread_speed = 5
entity.start_size = 20
entity.initial_state = 1
entity.teleport(player.origin)
entity.spawn()
entity.set_parent(player, 'rfoot')

player.push(0, 200, True)
player.jetpack = True

has_jet[player.userid] = True
jet_left[player.userid] -= 1

Sound('/ambient/machines/thumper_startup1.wav').play(player.index)

if jet_left[player.userid] == 0:
SayText2("[Jetpack] Das war dein letztes Jetpack!").send(index)
else:
SayText2(
"[Jetpack] Du hast noch {jetpacks}/3 Jetpacks!".format(
jetpacks=jet_left[player.userid],
)
).send(index)

timer_trail = Delay(5, entity.remove)
timer_jet = Delay(5, player.set_jetpack, [0])
timer_data = Delay(5, remove_timer, [player.userid])


# =============================================================================
# >> HELPER FUNCTIONS
# =============================================================================
def remove_timer(userid):
has_jet[userid] = False
index = index_from_userid(userid)
Sound('/ambient/machines/thumper_hit.wav').play(index)

def init_dicts(player):
has_jet[player.userid] = False
jet_left[player.userid] = 3

for player in PlayerIter():
init_dicts(player)
Image
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Sat Oct 08, 2016 3:30 pm

Same Problem satoon

Syntax: Select all

17:30:14 sp plugin reload jet
17:30:14 [SP] Unable to unload plugin 'jet' as it is not currently loaded.
[SP] Loading plugin 'jet'...

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/manager.py", line 75, in __missing__
instance = self.instance(plugin_name, self.base_import)
File "../addons/source-python/packages/source-python/plugins/instance.py", line 82, in __init__
self._plugin = import_module(import_name)
File "../addons/source-python/plugins/jet/jet.py", line 17, in <module>
from supermod.supermod import admins, isadmin

ImportError: No module named 'supermod'


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

Re: [HL2:DM] Jet Pack Help

Postby satoon101 » Sat Oct 08, 2016 3:33 pm

Well, that's not my fault. You need to install supermod, whatever that is, for it to work.
Image
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Sat Oct 08, 2016 3:57 pm

I asked for a standalone.

The Super Mod does not work anymore.
Latest version SP.
I would not publish it here.
I can send them privately if they want?
User avatar
satoon101
Project Leader
Posts: 2319
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Jet Pack Help

Postby satoon101 » Sat Oct 08, 2016 4:02 pm

Oh, sorry, didn't fully understand that part in your first post. I removed the sections above that deal with administration.
Image
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Sat Oct 29, 2016 12:52 pm

Ah damned it goes not off
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Tue Nov 01, 2016 4:18 pm

At the Last update SP,
the jetpack is no longer sufficient.
One flies farther and farther, and after death one drags a smoke cloud to itself.

Can anybody Repair please?
User avatar
L'In20Cible
Project Leader
Posts: 914
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [HL2:DM] Jet Pack Help

Postby L'In20Cible » Tue Nov 01, 2016 5:07 pm

Any error into the ../logs/source-python/* files?
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Tue Nov 01, 2016 5:09 pm

I have pfound this

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/commands/auth.py", line 30, in __call__
    return self.callback(*args)
  File "../addons/source-python/plugins/jet/jet.py", line 85, in _jet_say_command
    if jet_left[userid] == 0:

NameError: name 'userid' is not defined


[RocKs³] | RZ31: jet
L 11/01/2016 - 18:08:44: "[RocKs³] | RZ31<5><[U:1:43907303]><Unassigned>" say "jet"
User avatar
satoon101
Project Leader
Posts: 2319
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Jet Pack Help

Postby satoon101 » Tue Nov 01, 2016 5:20 pm

That should have been an issue the entire time. Not sure why it would just now appear. Updated the plugin above to fix the error.
Image
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Tue Nov 01, 2016 5:32 pm

Thanks Satoon this work.
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Thu Dec 29, 2016 2:36 am

With the latest SP version there is this error with the Jetpack.
Could someone fix it?

Syntax: Select all

[RocKs³] | Mr.[S]aint Santa: jet
L 12/29/2016 - 03:34:07: "[RocKs³] | Mr.[S]aint Santa<3><[U:1:43907303]><Unassigned>" say "jet"
Spawn/Chat Protection; FireGameEvent handle PlayerSay, name = 'player_say'
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/commands/auth.py", line 44, in __call__
return self.callback(*args)
File "../addons/source-python/plugins/jet/jet.py", line 76, in _jet_say_command
if has_jet[player.userid]:

KeyError: 3


[RocKs³] | Mr.[S]aint Santa: jet
L 12/29/2016 - 03:34:06: "[RocKs³] | Mr.[S]aint Santa<3><[U:1:43907303]><Unassigned>" say "jet"


[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/commands/auth.py", line 44, in __call__
return self.callback(*args)
File "../addons/source-python/plugins/jet/jet.py", line 76, in _jet_say_command
if has_jet[player.userid]:
User avatar
Ayuto
Project Leader
Posts: 1577
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [HL2:DM] Jet Pack Help

Postby Ayuto » Thu Dec 29, 2016 11:47 am

That exception didn't occur due to an update. It happened because you loaded the plugin while being already on the server. However, I have updated Satoon's plugin so that you can also load it when players are already on the server.
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Thu Dec 29, 2016 1:29 pm

Problem

Syntax: Select all

14:28:49 [SP] Unable to unload plugin 'jet' as it is not currently loaded.
[SP] Loading plugin 'jet'...

[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/manager.py", line 75, in __missing__
instance = self.instance(plugin_name, self.base_import)
File "../addons/source-python/packages/source-python/plugins/instance.py", line 82, in __init__
self._plugin = import_module(import_name)
File "../addons/source-python/plugins/jet/jet.py", line 39, in <module>
init_dicts(player)

NameError: name 'init_dicts' is not defined


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

Re: [HL2:DM] Jet Pack Help

Postby satoon101 » Thu Dec 29, 2016 2:07 pm

Updated above to fix that error.
Image
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Thu Dec 29, 2016 2:46 pm

Ok new problem,

I can not land anymore I can fly up and down all the time.
User avatar
Ayuto
Project Leader
Posts: 1577
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [HL2:DM] Jet Pack Help

Postby Ayuto » Thu Dec 29, 2016 2:59 pm

You should see an exception in your logs. However, I have updated the plugin again (delay update).
User avatar
Painkiller
Senior Member
Posts: 205
Joined: Sun Mar 01, 2015 8:09 am
Contact:

Re: [HL2:DM] Jet Pack Help

Postby Painkiller » Thu Dec 29, 2016 3:25 pm

Thanks work good

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 1 guest