Page 1 of 2

[HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 1:40 pm
by Painkiller
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

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 3:18 pm
by satoon101
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)

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 3:30 pm
by Painkiller
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.

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 3:33 pm
by satoon101
Well, that's not my fault. You need to install supermod, whatever that is, for it to work.

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 3:57 pm
by Painkiller
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?

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 08, 2016 4:02 pm
by satoon101
Oh, sorry, didn't fully understand that part in your first post. I removed the sections above that deal with administration.

Re: [HL2:DM] Jet Pack Help

Posted: Sat Oct 29, 2016 12:52 pm
by Painkiller
Ah damned it goes not off

Re: [HL2:DM] Jet Pack Help

Posted: Tue Nov 01, 2016 4:18 pm
by Painkiller
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?

Re: [HL2:DM] Jet Pack Help

Posted: Tue Nov 01, 2016 5:07 pm
by L'In20Cible
Any error into the ../logs/source-python/* files?

Re: [HL2:DM] Jet Pack Help

Posted: Tue Nov 01, 2016 5:09 pm
by Painkiller
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"

Re: [HL2:DM] Jet Pack Help

Posted: Tue Nov 01, 2016 5:20 pm
by satoon101
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.

Re: [HL2:DM] Jet Pack Help

Posted: Tue Nov 01, 2016 5:32 pm
by Painkiller
Thanks Satoon this work.

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 2:36 am
by Painkiller
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]:

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 11:47 am
by Ayuto
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.

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 1:29 pm
by Painkiller
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.

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 2:07 pm
by satoon101
Updated above to fix that error.

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 2:46 pm
by Painkiller
Ok new problem,

I can not land anymore I can fly up and down all the time.

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 2:59 pm
by Ayuto
You should see an exception in your logs. However, I have updated the plugin again (delay update).

Re: [HL2:DM] Jet Pack Help

Posted: Thu Dec 29, 2016 3:25 pm
by Painkiller
Thanks work good

Re: [HL2:DM] Jet Pack Help

Posted: Fri Jan 12, 2018 6:00 pm
by Painkiller
No longer works for BMS.

Code: Select all

[SP] Loading plugin 'jet'...

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
    plugin = self.manager.load(plugin_name)
  File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load
    plugin._load()
  File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
    self.module = import_module(self.import_name)
  File "../addons/source-python/plugins/jet/jet.py", line 21, in <module>
    info = PluginInfo()

TypeError: __init__() missing 1 required positional argument: 'name'


[SP] Plugin 'jet' was unable to be loaded.