Search found 57 matches

by nergal
Sun Jul 12, 2015 4:33 am
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

If you are encountering an error prior to your print statement, the print statement will never be called. Since you use int(command[1]), and command[1] is not an value that can be typecast to integer, you will get a ValueError. If you put your print statement prior to the erroring line, it will pri...
by nergal
Sun Jul 12, 2015 12:39 am
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

I think you missed my most recent post (I double posted). Currently, we just pass the CCommand instance itself. That instance will always have exactly 2 values. command[0] is always "say" and command[1] is always the actual message the player said in chat. So, currently, you will need to ...
by nergal
Sun Jul 12, 2015 12:22 am
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

That thread you were looking at was probably very old. The wiki should typically be up to date. Threads on the forum are never updated for API changes. still having issue with command[1]... The wiki says command[1] will give me the 1st argument while command[0] is the command name itself. Everytime...
by nergal
Sat Jul 11, 2015 9:52 pm
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

SayCommand, SayFilter, ClientCommand, and ClientCommandFilter all have the player's PlayerInfo instance as the first argument in the callback, not their index: http://wiki.sourcepython.com/pages/commands.client http://wiki.sourcepython.com/pages/commands.say I got the code from an example snippet o...
by nergal
Sat Jul 11, 2015 9:12 pm
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

ok what about this picture?

http://i.imgur.com/KHKQPAp.png

wtf?
by nergal
Sat Jul 11, 2015 9:06 pm
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

"playerinfo_from_index(PlayerInfo)" tells us that you're passing in a PlayerInfo instance, not an index. Try printing out the "index" before using it on a function hmmmm? @SayCommand('!pro') def pro_command(index, teamonly, CCommand): text = CCommand[1].s...
by nergal
Sat Jul 11, 2015 7:35 pm
Forum: Plugin Development Support
Topic: [TF2] *_from_index functions are screwed up...
Replies: 20
Views: 15032

[TF2] *_from_index functions are screwed up...

everytime I use a "*_from_index" function on players, it keeps throwing me this error... incorrect CPP sigs... boost.python.argerror: Python argument types in _players._helpers.playerinfo_from_index(PlayerInfo) did not match CPP signature: playerinfo_from_index(int, bool raise_exception=True) http:/...
by nergal
Mon Jul 06, 2015 12:49 am
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

I realize you said no global variables, but I really think that a global dictionary to store player instances by userid would be your best bet: class _PlayerDictionary(dict): def __missing__(self, userid): value = index_from_userid(userid, False) if value is not None: value ...
by nergal
Sun Jul 05, 2015 10:06 pm
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

a small question with Python... How would I carry over data from one Event function to another without using a global variable? Example: I set the player's iLives field to '1' and I need to carry it to the player_death event so I can interpret the lives logic. How can I do this example without using...
by nergal
Sat Jul 04, 2015 1:52 am
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 39122

I went with the PyCharm since I've heard of it but how would I set up the environment? This would also be a very nice piece in the Wiki as well.
by nergal
Fri Jul 03, 2015 12:58 am
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 39122

If you have Source.Python specific imports, you need a Source.Python environment for it to compile in, afaik. And even that won't catch all errors. It is highly recommended that to post in this section you should not only make sure the plugin loads, but functions properly. To do that, you need to r...
by nergal
Thu Jul 02, 2015 9:26 pm
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 39122

I'm happy that you play around with SP, but you should really test your code before posting on the forums -- at least when it comes to code examples! There are some errors in your code. I apologize, I'm used to compiling my code as I did with sourcemod but I don't know how to test-compile with sour...
by nergal
Thu Jul 02, 2015 12:20 pm
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 39122

I'm happy that you play around with SP, but you should really test your code before posting on the forums -- at least when it comes to code examples! There are some errors in your code. I apologize, I'm used to compiling my code as I did with sourcemod but I don't know how to test-compile with sour...
by nergal
Wed Jul 01, 2015 11:42 pm
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

You're still passing a second variable on __init__ which will cause an error. In Python, __new__ gets called prior to __init__. Our __new__ class method for Entity/PlayerEntity requires exactly 1 argument, the entity's/player's index. This is where the error would be encountered when you pass too m...
by nergal
Wed Jul 01, 2015 4:02 pm
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 39122

[TF2] getting healing target + checking if player is being healed from a dispenser

Two code examples for those wishing to go into TF2 :smile: 'get_healing_target' SHOULD return the heal-player of the player's medigun Then there's 'is_near_dispenser' which checks to see how much stuff is healing the player and sorting it out whether it's from medics or not. Thus, it works very nice...
by nergal
Wed Jul 01, 2015 12:08 am
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

I had a feeling encapsulation was unnecessary.
by nergal
Tue Jun 30, 2015 7:04 pm
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

Did you have a specific question you wanted answered? I would highly recommend using math.pi instead of creating a variable to store pi's value: from math import pi print(pi) https://docs.python.org/3/library/math.html#math.pi Also, lines 23 and 25 would cause errors, since you seem to be d...
by nergal
Tue Jun 30, 2015 1:45 pm
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23031

New Project: Porting Saxton Hale mod for Source.Python

So everybody, I've decided that, for my first real plugin here, I'd port the popular saxton hale mod from SourcePawn to Python using real object-orientation! so far, making a nice class for the bosses. I'm debating if I should encapsulate the class members or just leave them public as this will be m...
by nergal
Mon Jun 29, 2015 6:15 am
Forum: Plugin Releases
Topic: simple death and kill streaks tracker
Replies: 16
Views: 13557

You also might want to set the deathstreaks regardless of whether victim id equals attacker id or not, otherwise suicides wouldn't count as deaths. in the cases of suicide, the killer is the player I believe. reason why range of 0-65 is because the Source Engine supports 64 players + a SourceTV or ...

Go to advanced search