How could a plugin which for a mapchange on tdm changed
and after another mapchange also create back to dm?
[HL2:DM] One Mapchange to Tdm and DM
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] One Mapchange to Tdm and DM
This should do the trick:
Syntax: Select all
from listeners import OnLevelShutdown
from engines.server import queue_command_string
GAMEMODE = 0
@OnLevelShutdown
def change_gamemode():
global GAMEMODE
GAMEMODE = 1 - GAMEMODE
queue_command_string('mp_teamplay ' + str(GAMEMODE))
Last edited by Ayuto on Tue May 28, 2019 10:50 am, edited 1 time in total.
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: [HL2:DM] One Mapchange to Tdm and DM
Syntax: Select all
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'scoreboard'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'scoreboard'.
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'explosive'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'explosive'.
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-28 01:10:18 - sp - MESSAGE [SP] Loading plugin 'blood'...
2019-05-28 01:10:18 - sp - MESSAGE [SP] Successfully loaded plugin 'blood'.
2019-05-28 01:10:19 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\plugins\gamemode\gamemode.py", line 11, in change_gamemode
engine_server.server_command('mp_teamplay ' + str(GAMEMODE))
AttributeError: '_EngineServer' object has no attribute 'server_command'
2019-05-28 01:10:36 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\plugins\gamemode\gamemode.py", line 11, in change_gamemode
engine_server.server_command('mp_teamplay ' + str(GAMEMODE))
AttributeError: '_EngineServer' object has no attribute 'server_command'
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: [HL2:DM] One Mapchange to Tdm and DM
Tryed it, and says that.
Re: [HL2:DM] One Mapchange to Tdm and DM
I have updated the code above.
I'm glad you figured how to post the errors here on the forum. But please do not make double posts. Your text and the error messages pefectly fit into a single post.
I'm glad you figured how to post the errors here on the forum. But please do not make double posts. Your text and the error messages pefectly fit into a single post.
- Painkiller
- Senior Member
- Posts: 751
- Joined: Sun Mar 01, 2015 8:09 am
- Location: Germany
- Contact:
Re: [HL2:DM] One Mapchange to Tdm and DM
@Ayuto
Would you be able to tie him up there?
viewtopic.php?f=37&t=2031
It would take me a lot further, which is also related to other things
Edit: I think it's because he always tries sm_nextmap. but he can not do anything with it I use map_cycle from iplayer
Would you be able to tie him up there?
viewtopic.php?f=37&t=2031
It would take me a lot further, which is also related to other things
Edit: I think it's because he always tries sm_nextmap. but he can not do anything with it I use map_cycle from iplayer
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: [HL2:DM] One Mapchange to Tdm and DM
Ok,Thank you. I will try it again.
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: [HL2:DM] One Mapchange to Tdm and DM
Syntax: Select all
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'sound'...
2019-05-28 15:17:37 - sp - MESSAGE [SP] Successfully loaded plugin 'sound'.
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-28 15:17:37 - sp - EXCEPTION
[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 194, 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\gamemode\gamemode.py", line 7
def change_gamemode()
^
SyntaxError: invalid syntax
2019-05-28 15:17:37 - sp - MESSAGE [SP] Plugin 'gamemode' was unable to be loaded.
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'scoreboard'...
2019-05-28 15:17:37 - sp - MESSAGE [SP] Successfully loaded plugin 'scoreboard'.
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'explosive'...
2019-05-28 15:17:37 - sp - MESSAGE [SP] Successfully loaded plugin 'explosive'.
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-28 15:17:37 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-28 15:17:37 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-28 15:17:37 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
Re: [HL2:DM] One Mapchange to Tdm and DM
Looks like you modified the script above locally. As you can see line 7 of the script above ends with a colon. The error message you posted says that your script doesn't has this colon. That's why you get a SyntaxError.
I'm really getting tired of this...
I'm really getting tired of this...
Who is online
Users browsing this forum: No registered users and 89 guests