(ノಠ益ಠ)ノ彡┻━┻

This commit is contained in:
zaCade 2019-07-16 20:09:58 +02:00
parent 6982207601
commit f370e88b55
2 changed files with 109 additions and 13 deletions

View File

@ -29,9 +29,10 @@ ConVar g_hCVar_ProtectionMinimal3;
/* INTERGERS */
int g_iCrownEntity = INVALID_ENT_REFERENCE;
int g_iSkullEntity = INVALID_ENT_REFERENCE;
int g_iDialogLevel = 100000;
int g_iPlayerWinner[3];
int g_iPlayerWinner[6];
int g_iPlayerDamage[MAXPLAYERS+1];
int g_iPlayerDamageHits[MAXPLAYERS+1];
int g_iPlayerDamageFrom1K[MAXPLAYERS + 1];
@ -228,6 +229,7 @@ public void OnMapStart()
{
PrecacheSound("unloze/holy.wav");
PrecacheModel("models/unloze/crown_v2.mdl");
PrecacheModel("models/unloze/skull.mdl");
AddFileToDownloadsTable("sound/unloze/holy.wav");
AddFileToDownloadsTable("models/unloze/crown_v2.mdl");
@ -241,6 +243,19 @@ public void OnMapStart()
AddFileToDownloadsTable("materials/models/unloze/crown/crown_bump.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_detail.vtf");
AddFileToDownloadsTable("materials/models/unloze/crown/crown_lightwarp.vtf");
AddFileToDownloadsTable("models/unloze/skull.mdl");
AddFileToDownloadsTable("models/unloze/skull.phy");
AddFileToDownloadsTable("models/unloze/skull.vvd");
AddFileToDownloadsTable("models/unloze/skull.sw.vtx");
AddFileToDownloadsTable("models/unloze/skull.dx80.vtx");
AddFileToDownloadsTable("models/unloze/skull.dx90.vtx");
AddFileToDownloadsTable("materials/models/unloze/skull/skull.vmt");
AddFileToDownloadsTable("materials/models/unloze/skull/skull.vtf");
AddFileToDownloadsTable("materials/models/unloze/skull/skull_bump.vtf");
AddFileToDownloadsTable("materials/models/unloze/skull/skull_horn_b.vmt");
AddFileToDownloadsTable("materials/models/unloze/skull/skull_horn_b.vtf");
AddFileToDownloadsTable("materials/models/unloze/skull/skull_horn_b_bump.vtf");
}
//----------------------------------------------------------------------------------------------------
@ -385,7 +400,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
//----------------------------------------------------------------------------------------------------
public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
g_iPlayerWinner = {-1, -1, -1};
g_iPlayerWinner = {-1, -1, -1, -1, -1, -1};
int iSortedListDefenders[MAXPLAYERS+1][3];
int iSortedCountDefenders;
@ -490,6 +505,8 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
Format(sBuffer, sizeof(sBuffer), "%s\n1. %N - %d infections", sBuffer, iSortedListInfectors[0][0], iSortedListInfectors[0][1]);
g_iPlayerWinner[3] = GetSteamAccountID(iSortedListInfectors[0][0]);
LH_LogPlayerEvent(iSortedListInfectors[0][0], "triggered", "ze_infector_first", true);
}
@ -497,6 +514,8 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
Format(sBuffer, sizeof(sBuffer), "%s\n2. %N - %d infections", sBuffer, iSortedListInfectors[1][0], iSortedListInfectors[1][1]);
g_iPlayerWinner[4] = GetSteamAccountID(iSortedListInfectors[1][0]);
LH_LogPlayerEvent(iSortedListInfectors[1][0], "triggered", "ze_infector_second", true);
}
@ -504,6 +523,8 @@ public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
Format(sBuffer, sizeof(sBuffer), "%s\n3. %N - %d infections", sBuffer, iSortedListInfectors[2][0], iSortedListInfectors[2][1]);
g_iPlayerWinner[5] = GetSteamAccountID(iSortedListInfectors[2][0]);
LH_LogPlayerEvent(iSortedListInfectors[2][0], "triggered", "ze_infector_third", true);
}
@ -565,17 +586,25 @@ public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (g_iPlayerWinner[0] == GetSteamAccountID(client) && !g_bHideCrown[client])
if (!g_bHideCrown[client])
{
CreateTimer(7.0, OnClientSpawnPost, client, TIMER_FLAG_NO_MAPCHANGE);
KillCrown();
if (g_iPlayerWinner[0] == GetSteamAccountID(client))
{
CreateTimer(7.0, OnClientSpawnPostCrown, client, TIMER_FLAG_NO_MAPCHANGE);
KillCrown();
}
else if (g_iPlayerWinner[3] == GetSteamAccountID(client))
{
CreateTimer(7.0, OnClientSpawnPostSkull, client, TIMER_FLAG_NO_MAPCHANGE);
KillSkull();
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnClientSpawnPost(Handle timer, int client)
public Action OnClientSpawnPostCrown(Handle timer, int client)
{
if (!IsClientInGame(client) || IsFakeClient(client) || !IsPlayerAlive(client))
return;
@ -584,6 +613,18 @@ public Action OnClientSpawnPost(Handle timer, int client)
SpawnCrown(client);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnClientSpawnPostSkull(Handle timer, int client)
{
if (!IsClientInGame(client) || IsFakeClient(client) || !IsPlayerAlive(client))
return;
KillSkull();
SpawnSkull(client);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -591,8 +632,14 @@ public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (g_iPlayerWinner[0] == GetSteamAccountID(client) && !IsPlayerAlive(client))
KillCrown();
if (!IsPlayerAlive(client))
{
if (g_iPlayerWinner[0] == GetSteamAccountID(client))
KillCrown();
if (g_iPlayerWinner[3] == GetSteamAccountID(client))
KillSkull();
}
}
//----------------------------------------------------------------------------------------------------
@ -637,6 +684,46 @@ void SpawnCrown(int client)
g_iCrownEntity = iCrownEntity;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
void SpawnSkull(int client)
{
int iSkullEntity = INVALID_ENT_REFERENCE;
if ((iSkullEntity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
return;
SetEntityModel(iSkullEntity, "models/unloze/skull.mdl");
DispatchKeyValue(iSkullEntity, "solid", "0");
DispatchKeyValue(iSkullEntity, "modelscale", "1.5");
DispatchKeyValue(iSkullEntity, "disableshadows", "1");
DispatchKeyValue(iSkullEntity, "disablereceiveshadows", "1");
DispatchKeyValue(iSkullEntity, "disablebonefollowers", "1");
float fVector[3];
float fAngles[3];
GetClientAbsOrigin(client, fVector);
GetClientAbsAngles(client, fAngles);
fVector[2] -= 30.0;
TeleportEntity(iSkullEntity, fVector, fAngles, NULL_VECTOR);
float fDirection[3];
fDirection[0] = 0.0;
fDirection[1] = 0.0;
fDirection[2] = 1.0;
TE_SetupSparks(fVector, fDirection, 1000, 200);
TE_SendToAll();
SetVariantString("!activator");
AcceptEntityInput(iSkullEntity, "SetParent", client);
g_iSkullEntity = iSkullEntity;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -646,6 +733,15 @@ void KillCrown()
g_iCrownEntity = INVALID_ENT_REFERENCE;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
void KillSkull()
{
if ((IsValidEntity(g_iSkullEntity) && AcceptEntityInput(g_iSkullEntity, "Kill")) || g_iSkullEntity != INVALID_ENT_REFERENCE)
g_iSkullEntity = INVALID_ENT_REFERENCE;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -657,8 +753,8 @@ public Action ZR_OnClientInfect(&client, &attacker, &bool:motherInfect, &bool:re
(g_iPlayerWinner[1] == GetSteamAccountID(client) && GetClientCount() >= g_hCVar_ProtectionMinimal2.IntValue) ||
(g_iPlayerWinner[2] == GetSteamAccountID(client) && GetClientCount() >= g_hCVar_ProtectionMinimal3.IntValue))
{
PrintToMessageHUD(client, 60, Float:{-1.0, 0.3}, {255, 255, 255, 255}, {255, 255, 255, 255}, 0, 0.1, 0.1, 5.0, 0.0, "You have been protected from being Mother Zombie\nsince you were the Top Defender last round!");
CPrintToChat(client, "{cyan}%t {white}%s", "Chat Prefix", "You have been protected from being Mother Zombie since you were the Top Defender last round!");
PrintToMessageHUD(client, 60, Float:{-1.0, 0.3}, {255, 255, 255, 255}, {255, 255, 255, 255}, 0, 0.1, 0.1, 5.0, 0.0, "%t", "Protected");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", "Protected");
EmitSoundToClient(client, "unloze/holy.wav", .volume=1.0);
return Plugin_Handled;

View File

@ -22,7 +22,7 @@
}
"Crown"
{
"en" "Crown"
"en" "Crowns"
}
"Crown Enabled"
{
@ -56,8 +56,8 @@
{
"en" "You will no longer be protected from being mother zombie."
}
"protected"
"Protected"
{
"en" "You have been protected from being mother zombie, since you where top defender last round."
"en" "You have been protected from being Mother Zombie,\n since you where Top Defender last round."
}
}