Page 1 of 1

First steps in Sp

Posted: Mon Feb 11, 2013 12:33 pm
by mister-man
Hay,

I want start to learn SP. But the first problem is to send an message o an player.

Syntax: Select all

from Source import Player
from Source import Engine
from messages import chat
from events import Event

@Event
def player_spawn(GameEvent):
# Chat Messages
userid = GameEvent.GetInt('userid')
player = Player.EdictOfUserid(userid)
index = Engine.IndexOfEdict(player)
chat(index, 'Test')


If a player joins, the whole server crashes with with the error "MESSAGE_END called with no active message".

A secound Question is, whats up with the wiki? Is there a way to restore it?

Posted: Mon Feb 11, 2013 3:18 pm
by satoon101
The message system has gotten a major overhaul, not only on the Python side, but on the C++ side as well (due to the protobuf system). So, if this is for CS:GO, you will need to compile the newest version yourself in order to send messages, then use the most up-to-date Python API.

Info on the message module updates:
http://www.sourcepython.com/showthread.php?204
http://www.sourcepython.com/showthread.php?261

Also, info on the translation module:
http://www.sourcepython.com/showthread.php?260

We are currently working on a complete overhaul of the plugin (C++ side) which will make things much more maintainable in the future, so we will not be releasing a build until that is further along in development:
http://www.sourcepython.com/showthread.php?274

If you are running a Windows server, you can build by using this tutorial:
http://www.sourcepython.com/showthread.php?26#post129

Unfortunately, we are having build issues on Linux with the default branch, so we cannot release a build for that branch at this time. And, since we are working on the overhaul, it would not serve us well to work on those issues when our time would be better spent finishing the overhaul and getting that build ready for release.

As for the Wiki, unfortunately we were not able to recover anything from it. I have a thread asking if anyone wants to become a Wiki Contributor to get it back up and running, but have not received any replies on that as of yet:
http://www.sourcepython.com/showthread.php?270

The development team, at this time, does not have any time to be working on the Wiki, so until we get some volunteers, it will remain empty.

*Edit: I went ahead and removed the download, as it will cause crashing when using the messaging system (since it no longer exists in CS:GO).

Satoon

Posted: Mon Feb 11, 2013 4:52 pm
by mister-man
Sorry for the question about the wiki.

Of course I can help to write the wiki but my knowledge about SP is currently bad. So I will learn it and later I can help...

Posted: Mon Feb 11, 2013 7:36 pm
by mister-man
I tryed to test it, but there is no saytext2 in lib's and the sp download link is broken... (http://code.google.com/p/source-python/downloads/list) ---> No download :(


It seems I must wait for the next release...

Posted: Mon Feb 11, 2013 7:51 pm
by satoon101
I removed the download because that version causes crashing when using the messaging system, as you have seen in your testing. Due to Valve updating to use the new protobuf system in CS:GO, the old UserMessage system got removed completely for that version of the engine. Again, as I posted earlier, if you are running a Windows server, you will need to compile yourself. If you are running Linux, it will not compile, and you will just have to wait until the overhaul has gotten far enough along that we can release a build.

Satoon

Posted: Thu Jun 13, 2013 11:04 am
by mister-man
Hay all,

after the last release, I tried a second start in SP.

I tried to send a message at spawn to every alive player in CT and T Team. But every time I tried to start my script, there are import bugs from source.

Posted: Fri Jun 14, 2013 2:25 pm
by Omega_K2
That's because of the rewrite. Some stuff doesn't exist anymore and "Source" has been replaced.

Posted: Sat Jun 15, 2013 3:11 pm
by mister-man
Okay,

are there some examples of basic functions like messaging or weapon or player?
Everything I found doesn't work...

Posted: Sun Jun 16, 2013 12:18 am
by satoon101
http://www.sourcepython.com/forumdisplay.php?37-Wiki

Not everything "works" right now. This is an alpha still, so don't expect everything to work 100%.

Satoon

Posted: Tue Jun 18, 2013 11:39 am
by mister-man
It seems the wiki is empty....

Posted: Tue Jun 18, 2013 12:51 pm
by satoon101
Yeah, sorry about that. I am reworking it a little bit. I will hopefully have it back up by the end of the day. Sorry for the inconvenience.

Satoon