You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

83 lines
2.3 KiB

/* Plugin Template generated by Pawn Studio */
#include <sourcemod>
#include <sdktools_functions>
new bool:enabled, health[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "TF2 Halloween teamwork forcer",
author = "Chefe",
description = "<- Description ->",
version = "1.0",
url = "<- URL ->"
}
public OnPluginStart()
{
enabled = false;
HookEvent("player_hurt", Event_PlayerHurt);
HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("eyeball_boss_killed", Event_BossLeft);
HookEvent("eyeball_boss_escaped", Event_BossLeft);
HookEvent("pumpkin_lord_killed", Event_BossLeft);
HookEvent("merasmus_killed", Event_BossLeft);
HookEvent("merasmus_escaped", Event_BossLeft);
HookEvent("merasmus_summoned", Event_BossSpawn);
HookEvent("eyeball_boss_summoned", Event_BossSpawn);
HookEvent("pumpkin_lord_summoned", Event_BossSpawn);
}
public Event_BossSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
enabled = true;
PrintToChatAll("\x04Boss fight! All PvP damage gets reflected!");
}
public Event_BossLeft(Handle:event, const String:name[], bool:dontBroadcast)
{
enabled = false;
PrintToChatAll("\x04Boss fight ended! Normal PvP damage again");
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
health[client] = GetClientHealth(client);
}
public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
if (enabled)
{
new client_userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(client_userid);
new attacker_userid = GetEventInt(event, "attacker");
new attacker = GetClientOfUserId(attacker_userid);
new damage = GetEventInt(event, "damageamount");
new String:authstring[200];
GetClientAuthString(attacker, authstring, sizeof(authstring));
if (strcmp(authstring, "BOT", false) == 0 || attacker == 0 || client == attacker)
{
return Plugin_Handled;
}
if (IsClientInGame(client) && IsPlayerAlive(client))
{
SetEntData(client, FindDataMapOffs(client, "m_iMaxHealth"), health[client], 4, true);
SetEntData(client, FindDataMapOffs(client, "m_iHealth"), health[client], 4, true);
}
SlapPlayer(attacker, damage);
return Plugin_Handled;
}
return Plugin_Continue;
}