Hi everyone,
Sorry for my bad English again, but I'm still a Swiss since my last topic
I would like to release this small anti spawnkills plugin.
I made it because this week i played a lot on the face off maps, and sometimes the respawns were terribly bads....
You can set a deadline by which the players can not kill or be killed. (after spawn)
And you can chosse if it tells to players when they shot/are shoted by players during that free spawn time...
Add those lines to the sv_config.ini :
Csharp source code :
I'm open to every suggestions or comments.
Have Fun!
Sorry for my bad English again, but I'm still a Swiss since my last topic
I would like to release this small anti spawnkills plugin.
I made it because this week i played a lot on the face off maps, and sometimes the respawns were terribly bads....
You can set a deadline by which the players can not kill or be killed. (after spawn)
And you can chosse if it tells to players when they shot/are shoted by players during that free spawn time...
Add those lines to the sv_config.ini :
Code:
[AntiSpawnKills]
Enabled=1
// 0 or 1
SpawnFreeDelay=3
// Free time with no kills / deaths possible in seconds
SpawnFreeDelayShotInfo=1
// Indicate to the attacker and the victim when they shot/are shoted by players during the free spawn delay
Csharp source code :
CSHARP Code
- using System;
- using System.Collections;
- using System.Text;
-
- using Addon;
-
- namespace AntiSpawnKills
- {
- public class Class1 : CPlugin
- {
- // Create an array of datetimes
- // Store the plugin status
- private string enabled = "0";
- // Store the free spawn delay
- private int free_spawn_delay = 0;
- // Store the free spawn delay shot info
- private int free_spawn_delay_shot_info = 0;
-
- public override void OnServerLoad()
- {
- // Get the plugin status
- enabled = GetServerCFG("AntiSpawnKills", "Enabled", "0");
- // Get the free spawn delay
- free_spawn_delay = Int32.Parse(GetServerCFG("AntiSpawnKills", "SpawnFreeDelay", "2"));
- // Get the free spawn delay shot info
- free_spawn_delay_shot_info = Int32.Parse(GetServerCFG("AntiSpawnKills", "SpawnFreeDelayShotInfo", "1"));
- // Print plugin loaded
- ServerPrint("Plugin AntiSpawnKills loaded! (Enabled => " + enabled + ")");
- }
-
- public override void OnPlayerSpawned(ServerClient Client)
- {
- // If plugin is enabled
- if (enabled == "1")
- {
- // Store the player spawn DateTime
- players_list[Client.ClientNum] = DateTime.Now;
- }
- }
-
- public override int OnPlayerDamaged(ServerClient Attacker, ServerClient Victim, String Weapon, int Damage)
- {
- // If plugin is enabled
- if (enabled == "1")
- {
- // If the attacker is not the victim
- if (Attacker.XUID != Victim.XUID)
- {
- if (DateTime.Now.Subtract(players_list[Attacker.ClientNum]).TotalSeconds <= free_spawn_delay)
- {
- // If the Attacker is in free spawn delay
- // Set damage to 0
- Damage = 0;
- // If free spawn delay shot info is enabled
- if (free_spawn_delay_shot_info == 1)
- {
- TellClient(Attacker.ClientNum, "Impossible to kill during free spawn (" + Math.Round(free_spawn_delay - DateTime.Now.Subtract(players_list[Attacker.ClientNum]).TotalSeconds, 2) + " s. left)", true);
- TellClient(Victim.ClientNum, "You were shoted by a player in free spawn (" + Math.Round(free_spawn_delay - DateTime.Now.Subtract(players_list[Attacker.ClientNum]).TotalSeconds, 2) + " s. left)", true);
- }
- }
- else if (DateTime.Now.Subtract(players_list[Victim.ClientNum]).TotalSeconds <= free_spawn_delay)
- {
- // If the Victim is in free spawn delay
- // Set damage to 0
- Damage = 0;
- // If free spawn delay shot info is enabled
- if (free_spawn_delay_shot_info == 1)
- {
- TellClient(Attacker.ClientNum, "The player is in free spawn (" + Math.Round(free_spawn_delay - DateTime.Now.Subtract(players_list[Victim.ClientNum]).TotalSeconds, 2) + " s. left)", true);
- TellClient(Victim.ClientNum, "You were shoted during free spawn (" + Math.Round(free_spawn_delay - DateTime.Now.Subtract(players_list[Victim.ClientNum]).TotalSeconds, 2) + " s. left)", true);
- }
- }
- }
- }
- // Return the final damage
- return Damage;
- }
- }
- }
I'm open to every suggestions or comments.
Have Fun!