Search found 241 matches

by Mahi
Fri Jul 03, 2015 11:49 am
Forum: Plugin Development Support
Topic: player/entity constants: GODMODE
Replies: 10
Views: 6796

Players are entities. Using m_takedamage allows you to set it so that an entity/player does not take damage. This is a true godmode instead of being tricky with life states. What would be the most convenient way of using m_takedamage? Is there a property for it or should I use player.set_property_b...
by Mahi
Thu Jul 02, 2015 1:12 pm
Forum: Plugin Development Support
Topic: Guarantee an event listener to be called before other listeners of the same event?
Replies: 2
Views: 2723

Guarantee an event listener to be called before other listeners of the same event?

How would I ensure that my player_spawn event listener gets called before others? I'm trying to reset every player's gravity to 1.0 whenever they spawn, and I want to make sure it happens before other player_spawn functions modify the gravity again. Here's an easy example code of what I have: # ../p...
by Mahi
Thu Jul 02, 2015 12:47 pm
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 40173

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 Mahi
Thu Jul 02, 2015 11:50 am
Forum: News & Announcements
Topic: New release July 2nd, 2015!!
Replies: 14
Views: 37442

These are some insanely nice features! Awesome job, thank you very much for these! :)
by Mahi
Thu Jul 02, 2015 11:43 am
Forum: Code examples / Cookbook
Topic: [TF2] getting healing target + checking if player is being healed from a dispenser
Replies: 20
Views: 40173

We (Python coders in general) don't use parenthesis around if sentences in Python, unless the if sentence is splitted on two lines like so: if (player is not None and not player.isdead and get_healing_target(player).userid == client.userid): medics += 1 But all other paranthesis shou...
by Mahi
Tue Jun 30, 2015 10:43 pm
Forum: Plugin Development Support
Topic: Adding a tint overlay (fade user message?) on player's screen
Replies: 3
Views: 3068

The Fade class has been a part of the messages package since its creation. I did test using the numbers you have, but I am receiving errors. So, I lowered the 500 and 482 down to 5 and 2, and it worked like a charm: from colors import RED from events import Event from messages import Fade from play...
by Mahi
Tue Jun 30, 2015 9:35 pm
Forum: Plugin Development Support
Topic: Adding a tint overlay (fade user message?) on player's screen
Replies: 3
Views: 3068

Adding a tint overlay (fade user message?) on player's screen

Say I want to make player's screen "bloody" by adding a red tint to it, how would this be done?

In eventscripts I would add a tint like so:

Code: Select all

es usermsg fade event_var(userid) 0 500 482 255 0 0 150
by Mahi
Tue Jun 30, 2015 7:12 pm
Forum: Plugin Development Support
Topic: New Project: Porting Saxton Hale mod for Source.Python
Replies: 27
Views: 23217

I'm debating if I should encapsulate the class members or just leave them public as this will be my first real object-oriented plugin. Rarely should you "encapsulate" (there's no true encapsulation in Python) anything. But if you want, you can mark attributes or methods "private" with a leading und...
by Mahi
Mon Jun 22, 2015 12:49 am
Forum: Plugin Development Support
Topic: __init__ (constructor) question when inheriting
Replies: 11
Views: 6652

BackRaw wrote:Next is dict, and here I'm not sure, Mahi - is it safe to leave __init__ out?
Yes, and you absolutely should. Only define an __init__ if it differs from the super class's __init__.

Edit: Regardless of what pylint says, unless someone can reason why it complains about this.
by Mahi
Mon Jun 22, 2015 12:34 am
Forum: Plugin Development Support
Topic: __init__ (constructor) question when inheriting
Replies: 11
Views: 6652

Satoon might be right about the pylint, but no, you don't have to define __init__ in a subclass if it doesn't do anything different from its super class's __init__. There's absolutely no benefit of doing this. Also, I couldn't find anything about this on PEP8, nor do I personally see why would you e...
by Mahi
Tue Jun 09, 2015 10:36 am
Forum: Plugin Development Support
Topic: [TF2] VGUIMenu not working
Replies: 7
Views: 5281

Bump! Apparently this code no longer works, I get the MOTD popup but the website doesn't show. Any fix? Using CS:S.
by Mahi
Fri Jun 05, 2015 1:00 pm
Forum: General Discussion
Topic: Python's eval() function
Replies: 9
Views: 7297

You're better off parsing a string, looking for calculations, rather than trying to use eval on it.
by Mahi
Thu Jun 04, 2015 1:20 pm
Forum: General Discussion
Topic: Few questions regarding S.P and SourceMod
Replies: 18
Views: 14033

Not to mention, if you compile your code to .pyc on a linux and try to run the same code on windows, won't work. Same for 32-bit vs 64-bit.

Correct me if I'm wrong?
by Mahi
Tue Jun 02, 2015 10:12 am
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

You simply have two methods, get & set, plus a property that makes accessing these easier (but does the same thing). I think the .setter stuff would make code less readable. Don't know about the alpha parameter tho. What's so wrong about having two methods and then a wrapper for both of them as...
by Mahi
Mon Jun 01, 2015 9:57 pm
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

I don't mean to be rude at any point of this answer, I'm just trying to say what I think about all this, and I like being kind of "offensive" (making my points clear :grin: ) when trying to prove my point. That being said, here's my personal opinion on this stuff, with some sort of argumen...
by Mahi
Fri May 29, 2015 8:57 pm
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

Well, I don't think that fully applies in this instance as, in my view, that is for not creating 2 separate and distinct ways of doing the same thing. If we were to fully follow that rule as if it applied fully universally, one could argue that using the Entity/PlayerEntity attributes we add dynami...
by Mahi
Fri May 29, 2015 7:07 pm
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

We decided that we want to have properties, because we think they are more handy. I completely agree with you. Which is why I'd just go with the "newest" version of using properties, instead of having set and get methods separately. Example: class Example: @property def x(self): r...
by Mahi
Fri May 29, 2015 1:42 pm
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

The property wraps the 2 methods. This is actually a fairly common practice. We use it quite a bit for Entity/PlayerEntity. Never seen it before, I've only seen people use either properties (usually with the decorator) or set_x() and get_x() methods, but never both (doesn't mean it's wrong or anyth...
by Mahi
Fri May 29, 2015 12:11 pm
Forum: Plugin Development Support
Topic: how to show name of player that you are pointing to
Replies: 22
Views: 12808

Just so you know, we did already implement a get_view_entity method for PlayerEntity along with a view_player property: print(player.get_view_player().name) print(player.view_player.name) Of course, those 2 will return None if the player is not looking at another player. Tha...
by Mahi
Sun May 24, 2015 7:11 pm
Forum: Plugin Development Support
Topic: Property 'm_Effects' not found for entity type 'player'
Replies: 8
Views: 5229

Ayuto wrote:Do you perhaps mean "m_fEffects"? Though, that is accessible through <Entity object>.effects.

Well. Dammit. Google even gave me results on "m_Effects" :D Thanks Ayuto, works fine now :)

Go to advanced search