Hey Guys.
Thanks for all the help recently.
Could you give me code examples for:
how to kick a player from the server
how to send a text message to a player in the chat window
Thanks so much.
kick player, send message
For kicking:
http://www.sourcepython.com/showwiki.php?title=Wiki:CEngineServer#server_command
For SayText2 (chat area):
http://www.sourcepython.com/showwiki.php?title=Wiki:messages#SayText2
I'm not certain if that one works, though, as I never got around to testing the messaging system myself.
Satoon
http://www.sourcepython.com/showwiki.php?title=Wiki:CEngineServer#server_command
Syntax: Select all
from engine_c import CEngineServer
CEngineServer.server_command('kickid %s %s' % (userid, reason))
For SayText2 (chat area):
http://www.sourcepython.com/showwiki.php?title=Wiki:messages#SayText2
I'm not certain if that one works, though, as I never got around to testing the messaging system myself.
Satoon
satoon101 wrote:For kicking:
http://www.sourcepython.com/showwiki.php?title=Wiki:CEngineServer#server_commandSyntax: Select all
from engine_c import CEngineServer
CEngineServer.server_command('kickid %s %s' % (userid, reason))
For SayText2 (chat area):
http://www.sourcepython.com/showwiki.php?title=Wiki:messages#SayText2
I'm not certain if that one works, though, as I never got around to testing the messaging system myself.
Satoon
server command needs to be terminated with a ; or \n as far as I renember, i.e.
Syntax: Select all
CEngineServer.server_command('kickid %s %s;' % (userid, reason))
Also SayText2 used to work on both engines, dunno whether any of the updates broke anything though. I posted a thread somewhere with the usermessages that don't.
Libraries: k2tools
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
CEngineServer is the class object, but you need an instance of it.
Syntax: Select all
engine = engine_c.get_engine_interface()
engine.server_command('kickid %s %s;'% (userid, reason))
An error occurred importing SayText2. Is there a workaround for this?
ImportError: cannot import name DATA_PATH
[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/addons/manager.py', line 48, in __missing__
instance = _LoadedAddon(addon_name)
File '../addons/source-python/packages/source-python/addons/manager.py', line 237, in __init__
self._addon = __import__(addon_name + '.' + addon_name)
File '../addons/source-python/plugins/leetcoin/leetcoin.py', line 44, in <module>
from messages import SayText2
File '../addons/source-python/packages/source-python/messages/__init__.py', line 9, in <module>
from paths import DATA_PATH
ImportError: cannot import name DATA_PATH
Regarding the error: you have to change all DATA_PATH occurences to SP_DATA_PATH. Take a look at this revision. I'm currenctly not sure if it's included in the latest build.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 79 guests