PHP Code:
#pragma semicolon 1
#include <zombiereloaded>
#pragma newdecls required
public Plugin myinfo =
{
name = "Block the respawning of headshot zombies",
author = "cjsrk",
description = "<- Description ->",
version = "0.1_fix",
url = "<- URL ->"
}
bool IsHeadshot[MAXPLAYERS+1];
public void OnPluginStart()
{
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}
public void OnMapStart()
{
for(int i = 1; i <= MaxClients; i++) IsHeadshot[i] = false;
}
public void OnClientPutInServer(int client)
{
IsHeadshot[client] = false;
}
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
OnMapStart();
}
public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
if(!event.GetBool("headshot"))
return;
IsHeadshot[GetClientOfUserId(event.GetInt("userid"))] = true;
PrintToChatAll("Zombie lost his head! =)");
}
public Action ZR_OnClientRespawn(int &client, ZR_RespawnCondition &condition)
{
return IsHeadshot[client] ? Plugin_Handled : Plugin_Continue;
}
__________________