Sign in to follow this  
Followers 0
atrX

Anti Spawn Kill

13 posts in this topic

Since the link for Gabe's NoSpawnShoot plugin is down I figured I'd have a quick go at writing a proper plugin to prevent jumpers from killing the activator at the start of a round. There's 2 options you can pick between and it defaults to option #1:

  • Take away player's ammo.
  • Freeze player controls entirely.
Add this line in the main() function in _plugins.gsc to load the plugin:

loadPlugin( plugins\antiSpawnKill::init, "Anti Spawn Kill", "Slaya" );
Create a new file in the plugins folder called "antiSpawnKill.gsc" and paste this code into it:

/**
 * Plugin: Anti Spawn Kill
 * Author: JR-Imagine / Slaya
 * Description: Prevent jumpers from killing the activator at the start of a round.
 */

init( modVersion ) {
	/**
	 * 0 = disabled
	 * 1 = empty weapons
	 * 2 = freeze controls
	 */
	braxi\_dvar::addDvar( "plugin_antiSpawnKill_mode", "plugin_antiSpawnKill_mode", 1, 0, 2, "int" );

	if( level.dvar[ "plugin_antiSpawnKill_mode" ] == 0 )
		return;

	antiSpawnKillTime = 1.5;

	level thread onPlayerSpawn();
	level thread endAntiSpawnKill( antiSpawnKillTime );
}

onPlayerSpawn() {
	level endon( "end_anti_spawn_kill" );
	level endon( "round_ended" );

	for(;;) {
		level waittill( "player_spawn", player );

		if( player.pers[ "team" ] == "allies" ) {
			if( level.dvar[ "plugin_antiSpawnKill_mode" ] == 1 )
				player thread takePlayerAmmo();
			else
				player freezeControls( true );
		}
	}
}

endAntiSpawnKill( time ) {
	level endon( "round_ended" );

	level waittill( "round_started" );
	wait( time );

	level notify( "end_anti_spawn_kill" );

	players = getEntArray( "player", "classname" );
	for( i = 0; i < players.size; i++ ) {
		if( players[i].pers[ "team" ] == "allies" ) {
			if( level.dvar[ "plugin_antiSpawnKill_mode" ] == 1 )
				players[i] thread giveBackPlayerAmmo();
			else
				players[i] freezeControls( false );
		}
	}
}

takePlayerAmmo() {
	wait .1; // Add tiny delay so if mapper gives players weapons upon spawning these will be accounted for too

	self.antiSpawnKill_weapons = self getWeaponsListPrimaries();

	// Could just do giveMaxAmmo() on everything but just incase mapper didn't want people to spawn with max ammo...
	for( i = 0; i < self.antiSpawnKill_weapons.size; i++ ) {
		self.antiSpawnKill_ammoStock[ self.antiSpawnKill_weapons[i] ] = self getWeaponAmmoStock( self.antiSpawnKill_weapons[i] );
		self.antiSpawnKill_ammoClip[ self.antiSpawnKill_weapons[i] ] = self getWeaponAmmoClip( self.antiSpawnKill_weapons[i] );

		self setWeaponAmmoStock( self.antiSpawnKill_weapons[i], 0 );
		self setWeaponAmmoClip( self.antiSpawnKill_weapons[i], 0 );
	}
}

giveBackPlayerAmmo() {
	if( !isDefined( self.antiSpawnKill_weapons ) || !isDefined( self.antiSpawnKill_ammoStock ) || !isDefined( self.antiSpawnKill_ammoClip ) )
		return;

	for( i = 0; i < self.antiSpawnKill_weapons.size; i++ ) {
		self setWeaponAmmoStock( self.antiSpawnKill_weapons[i], self.antiSpawnKill_ammoStock[ self.antiSpawnKill_weapons[i] ] );
		self setWeaponAmmoClip( self.antiSpawnKill_weapons[i], self.antiSpawnKill_ammoClip[ self.antiSpawnKill_weapons[i] ] );
	}
}
3

Share this post


Link to post
Share on other sites

they have the same result though?

Please learn to read, at the top of his post it says "Since the link for Gabe's NoSpawnShoot plugin is down I figured I'd have a quick go at writing a proper plugin to prevent jumpers from killing the activator at the start of a round.

 

 

I think you're the dumb one here, not him.

0

Share this post


Link to post
Share on other sites

Please learn to read, at the top of his post it says "Since the link for Gabe's NoSpawnShoot plugin is down I figured I'd have a quick go at writing a proper plugin to prevent jumpers from killing the activator at the start of a round.

 

 

I think you're the dumb one here, not him.

I don't get it?

How does that make me dumb?

0

Share this post


Link to post
Share on other sites

they have the same result though?

In a sense yes but this plugin can be used like the Raid Death run where it freezes the control or used where it just takes the ammo preffible a lot of players don't like it when it takes away there weapon at the start so this is a pretty neat plugin.

 

This is why he refers it as "Improved"

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0