Spawnprotection

Release your plugins here!
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Spawnprotection

Postby Kami » Sun Aug 26, 2012 8:41 pm

Hey guys I just tried to make a small Spawnprotection mod.

Let me know what I could have done better and what is good!

The attachment spawnprotection.zip is no longer available


And yes I stole some of the format stuff from satoon^^
Attachments
spawnprotection.zip
(871 Bytes) Downloaded 548 times
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Aug 26, 2012 9:12 pm

Nice script! You can steal all the formatting you want from me, I encourage it.

One pointer, though, for the script. Since you use player_spawn, you should only give spawn protection to the player that spawned. If you only want to give beginning of round spawn protection, you should use round_freeze_end.

Satoon
your-name-here
Developer
Posts: 168
Joined: Sat Jul 07, 2012 1:58 am

Postby your-name-here » Sun Aug 26, 2012 9:17 pm

+1! The first useful script!
paytonpenn
Junior Member
Posts: 10
Joined: Tue Aug 21, 2012 5:52 pm

Postby paytonpenn » Tue Aug 28, 2012 1:19 am

I'm not understanding how its "godding" everyone on each individual spawn.
It could be bot related.. I just tested it offline..
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Postby Kami » Tue Aug 28, 2012 2:48 pm

Updated the addon to work on player_spawn (its not looping through every player anymore).
Now it can be used on any kind of server :)
User avatar
Monday
Administrator
Posts: 98
Joined: Thu Jul 12, 2012 4:15 am

Postby Monday » Tue Aug 28, 2012 3:35 pm

Here is how your script could work with [wiki]EasyPlayer[/wiki], which will become more functional in the future.

Syntax: Select all

from players import EasyPlayer

@Event
def player_spawn(GameEvent):
# Chat Messages
userid = GameEvent.GetInt('userid')
player = EasyPlayer(userid)
Chat(player.index, '[Spawnprotection] Enabled!')
say_delay = Timer(prot_time, Chat, (player.index, '[Spawnprotection] Disabled!'))
say_delay.start()
# Godmode
player.SetPropInt("CBaseAnimating.m_nHitboxSet", 2)
prot_delay = Timer(prot_time, player.SetPropInt, ["CBaseAnimating.m_nHitboxSet", 0])
prot_delay.start()
# Color settings
real_color = (255*65792+255)
if player.team == 2:
color = (255*2)
if player.team == 3:
color = (255*65536)
player.SetPropInt("CBaseEntity.m_clrRender", color)
rc_delay = Timer(prot_time, player.SetPropInt, ["CBaseEntity.m_clrRender", real_color])
rc_delay.start()
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Postby Kami » Tue Aug 28, 2012 3:38 pm

So is EasyPlayer available yet or comes with the next build?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Aug 28, 2012 3:40 pm

It was committed yesterday, but is not included in the latest download.

Satoon
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Tue Aug 28, 2012 3:50 pm

Monday wrote:Here is how your script could work with [wiki]EasyPlayer[/wiki], which will become more functional in the future.

Syntax: Select all

from players import EasyPlayer

@Event
def player_spawn(GameEvent):
# Chat Messages
userid = GameEvent.GetInt('userid')
player = EasyPlayer(userid)
Chat(player.index, '[Spawnprotection] Enabled!')
say_delay = Timer(prot_time, Chat, (player.index, '[Spawnprotection] Disabled!'))
say_delay.start()
# Godmode
player.SetPropInt("CBaseAnimating.m_nHitboxSet", 2)
prot_delay = Timer(prot_time, player.SetPropInt, ["CBaseAnimating.m_nHitboxSet", 0])
prot_delay.start()
# Color settings
real_color = (255*65792+255)
if player.team == 2:
color = (255*2)
if player.team == 3:
color = (255*65536)
player.SetPropInt("CBaseEntity.m_clrRender", color)
rc_delay = Timer(prot_time, player.SetPropInt, ["CBaseEntity.m_clrRender", real_color])
rc_delay.start()


Wouldn't you need to import the Chat() function ?
-Tuck
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Aug 28, 2012 3:58 pm

I think he was more showing how you would need to add the EasyPlayer import than just giving a whole script. You would also need to import Timer and Event, which are already included in the script itself.

Satoon
User avatar
Monday
Administrator
Posts: 98
Joined: Thu Jul 12, 2012 4:15 am

Postby Monday » Tue Aug 28, 2012 4:03 pm

satoon101 wrote:I think he was more showing how you would need to add the EasyPlayer import than just giving a whole script. You would also need to import Timer and Event, which are already included in the script itself.

Satoon


Correct. I was just showing how EasyPlayer could be used :)
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Tue Mar 24, 2015 12:46 pm

This Plugin not work for HL2DM
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Mar 24, 2015 1:12 pm

This addon was made for a very early version of Source.Python and doesn't work with the latest release. It requires some updates to work again.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Tue Mar 24, 2015 1:22 pm

Ok, thanks for the info
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Mar 24, 2015 1:30 pm

Maybe someone volunteers to update this script. I could do it, but I don't have time today.
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Wed Mar 25, 2015 1:46 am

I updated it, I'll likely do some further updates in the future, but for now I just made it do exactly what it used to do using updated functions.
Attachments
spawnprotection.zip
(1.88 KiB) Downloaded 397 times
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Wed Mar 25, 2015 4:03 am

A few things. First, this is Kami's plugin. While he has not updated it yet, he has been on in the last 2 weeks. We should probably allow him the opportunity to update his plugin.

Second, instead of getting and setting the color as you do, I would suggest using the PlayerEntity's 'color' property:

Syntax: Select all

# Somewhere in the global scope
from colors import RED
from colors import BLUE


protected_red = RED.with_alpha(64)
protected_blue = BLUE.with_alpha(64)


# Inside player_spawn

current_color = player.color
if player.team == 2:
player.color = protected_red
else:
player.color = protected_blue


Also, there is no need for 3 different delays. Simply use one and make a function that removes the protection:

Syntax: Select all

tick_delays.delay(prot_time, remove_protection, player, current_color)


def remove_protection(player, color):
SayText2(message="[SpawnProtection] Disabled!").send(player.index)
player.color = color
player.set_property_int('m_nHitboxSet', 0)


Obviously, if the player disconnects or the map changes, you will want to cancel the delay, but that is another matter.
Image
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Wed Mar 25, 2015 4:07 am

Yeah, that's why I said I would add further updates later. My intention was just to update it as faithfully to the original as possible to start, then do a full rewrite in my version to remove more of the bugs in the original plugin.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Postby Painkiller » Wed Mar 25, 2015 11:11 am

Hello,

(Test it in HL2DM)

could you fix this script, it's not working anymore. thanks in advance.


(and the fix from necavi notwork)

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 18 guests