Search found 1427 matches

by Ayuto
Mon Sep 03, 2012 8:39 pm
Forum: Plugin Development Support
Topic: EasyPlayer creates new instance on every call?
Replies: 5
Views: 14642

As you can see here EasyPlayer is a simple object. So everytime you want to get an instance, a new instance will be created. Here is an example to make it clear: >>> class Player(object): def __init__(self, userid): self.userid = userid >>> p1 = Player(1) >>> p1 <__main__.Pla...
by Ayuto
Sat Sep 01, 2012 6:19 pm
Forum: General Discussion
Topic: entity_edict.cpp question [How to respawn a player]
Replies: 12
Views: 48175

Yeah, that's right. es_spawnplayer and es_spawnentity are using DispatchSpawn. http://master.build.eventscripts.com/eventscripts/eventscripts2/file/6936a4bee74c/mattie_eventscripts.cpp#l3656
I'm pretty sure that it would work, if you set these props.
by Ayuto
Thu Aug 30, 2012 8:15 pm
Forum: General Discussion
Topic: paths.py suggestion
Replies: 5
Views: 21537

I prefer the path module, since it's a even easier. [python]from path import path

my_file_dir = path(__file__).dirname()[/python]
by Ayuto
Thu Aug 30, 2012 6:48 pm
Forum: Plugin Development Support
Topic: sqlite3 connect (PATH)
Replies: 4
Views: 16999

You can simply extend your path. So you could do it like this:

Syntax: Select all

conn = sqlite3.connect('csgo/addons/source-python/ADDON_NAME/kiwi.db')
by Ayuto
Wed Aug 29, 2012 8:30 am
Forum: General Discussion
Topic: Easy Way to port an existing Eventscripts Addon
Replies: 10
Views: 28633

BackRaw wrote:

Syntax: Select all

@Event # do I need this here ?
def unload():
myplayers.clear() # clear out our player dictionary

No, this is handled here: http://code.google.com/p/source-python/source/browse/addons/source-python/_libs/addons/manager.py#92 ;)
by Ayuto
Tue Aug 28, 2012 8:51 pm
Forum: General Discussion
Topic: Popup
Replies: 16
Views: 49888

by Ayuto
Wed Aug 15, 2012 10:56 am
Forum: Whatever
Topic: cs:go weapon list of all the weapon names in the game?
Replies: 12
Views: 34084

That isn't an issue and has nothing to do with Source Python. You might have noticed this behavior when using item_pickup with EventScripts. Some things contain the complete class name and other things only the partial class name.
by Ayuto
Sat Aug 11, 2012 3:51 am
Forum: API Design
Topic: Player List Filters
Replies: 20
Views: 74725

What's about something like this: def GetPlayers(players, *filters): # Code... pass So you would do it like this: # Get a tuple of all alive players alive = tuple(GetPlayers('alive')) # Get a list of all dead terrorists dead_terrorists = list(GetPlayers('t...
by Ayuto
Fri Aug 10, 2012 6:33 pm
Forum: API Design
Topic: Player List Filters
Replies: 20
Views: 74725

I would simply return an iterator (like map, filter, etc. do in Python 3) of all filtered player pointers. All further filtering need to be done by the script author (that isn't really hard or uncomfortable).
by Ayuto
Fri Jul 20, 2012 12:01 pm
Forum: Plugin Releases
Topic: The first Addon: Hide Disconnect-Reasons
Replies: 3
Views: 14327

This addon was wirtten before the name change. Freakyy should update or delete it to avoid confusions.
by Ayuto
Wed Jul 18, 2012 10:49 pm
Forum: API Design
Topic: Using __call__ to execute a command on server/client
Replies: 8
Views: 27699

Why do you define kwargs? :) Also, you can simply add another parameter before *args, so you will get a more clearer error, if you don't pass anything. With these changes I come up with this: >>> class _Server(object): def __call__(self, command, *args): command = command + ' ...
by Ayuto
Wed Jul 18, 2012 6:19 am
Forum: Whatever
Topic: Help appreciated :)
Replies: 16
Views: 55614

I don't have one, too. :( Just a banned account from one of my friend list and this account I need to share with others. :D
by Ayuto
Sun Jul 15, 2012 8:35 pm
Forum: General Discussion
Topic: A few questions according for scripts
Replies: 19
Views: 67280

Source.Python is still in developement, so some things may change with a new revision. I guess the script you saw was made before the idea with decorators. However here is an example.

Syntax: Select all

from events.decorators import event

@event
def player_say(game_event):
pass
by Ayuto
Sun Jul 15, 2012 2:33 pm
Forum: API Design
Topic: Event system discussion
Replies: 22
Views: 95694

I can just tell you that it worked for me, but I will test it again, when I will find some time. ;)
by Ayuto
Wed Jul 11, 2012 6:30 am
Forum: API Design
Topic: Event system discussion
Replies: 22
Views: 95694

And again, what if the try/except works but the variable is "supposed" to be a string (like the Event Variable "text" for player_say) but casting it to an integer or float works? Yeah, I haven't thought about this situation. And, changing the Event Variable's value does not actually change anything...
by Ayuto
Wed Jul 11, 2012 6:20 am
Forum: API Design
Topic: Coding Style
Replies: 42
Views: 832479

I agree with most of that. Personally, I just don't like function/method names in lower case with underscores, but i guess I will try to use it :D

But this would mean that Source.Python's function/method names need to be renamed, because they use the CapitalizedWords stlye.
by Ayuto
Tue Jul 10, 2012 9:07 pm
Forum: API Design
Topic: Event system discussion
Replies: 22
Views: 95694

What's about a simple try-except clause for getting a variable and an isinstance check for setting one? I guess that wouldn't cost much ressources. Also, I agree that a registerForEvent function could be usefull :)
by Ayuto
Mon Jul 09, 2012 5:55 pm
Forum: API Design
Topic: Get/Set event variables
Replies: 6
Views: 25180

Get/Set event variables

Yesterday, I compiled a version of Source.Python to play arround with the direct access. That's a very cool thing, but I have suggestion. At the moment we need to do the following to get/set an event variable: def player_disconnect(event): # Get the player's steam ID steamid = event.GetS...
by Ayuto
Mon Jul 09, 2012 12:24 pm
Forum: Whatever
Topic: So...
Replies: 3
Views: 18289

Hey,

you can always download the latest revision via a SVN client and compile it by yourself. You can find the code here. http://code.google.com/p/eventscripts-3/source/checkout

I guess the name will be Source Python :)
by Ayuto
Sat Jul 07, 2012 2:40 pm
Forum: API Design
Topic: Decorators vs the eventscripts way ..
Replies: 12
Views: 55392

Nice idea! The same you could do for server, client and say commands and everything else you need to register on load and unregister on unload. In one of my scripts I use decorators for commands and SPE detours and it makes the addon more clearer :-)

Go to advanced search