Page 1 of 1

[HL2:DM] One Mapchange to Tdm and DM

Posted: Mon Apr 18, 2016 4:35 pm
by Painkiller
How could a plugin which for a mapchange on tdm changed
and after another mapchange also create back to dm?

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Wed Apr 20, 2016 10:06 pm
by VinciT
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))

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 6:50 am
by daren adler

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'

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 6:55 am
by daren adler
Tryed it, and says that.

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 10:52 am
by Ayuto
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.

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 11:08 am
by Painkiller
@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

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 8:10 pm
by daren adler
Ok,Thank you. I will try it again.

Re: [HL2:DM] One Mapchange to Tdm and DM

Posted: Tue May 28, 2019 8:21 pm
by daren adler

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

Posted: Tue May 28, 2019 8:31 pm
by Ayuto
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...