sm-plugins/MVP_Stars/scripting/MVP_Stars.sp

85 lines
2.9 KiB
SourcePawn
Raw Normal View History

2018-07-23 10:51:04 +02:00
#include <sourcemod>
#include <cstrike>
#include <zombiereloaded>
new bool:G_bIsHuman[MAXPLAYERS+1];
new bool:G_bIsZombie[MAXPLAYERS+1];
2018-07-23 10:51:04 +02:00
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
2018-07-23 10:51:04 +02:00
public Plugin myinfo =
{
name = "MVP_Stars",
author = "zaCade",
description = "",
version = "1.0",
url = ""
2018-07-23 10:51:04 +02:00
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public OnPluginStart()
2018-07-23 10:51:04 +02:00
{
HookEvent("round_start", Event_RoundStart);
HookEvent("round_end", Event_RoundEnd);
2018-07-23 10:51:04 +02:00
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public ZR_OnClientInfected(client, attacker, bool:motherinfect, bool:respawnoverride, bool:respawn)
2018-07-23 10:51:04 +02:00
{
G_bIsHuman[client] = false;
G_bIsZombie[client] = true;
2018-07-23 10:51:04 +02:00
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
2018-07-23 10:51:04 +02:00
public ZR_OnClientHumanPost(client, bool:respawn, bool:protect)
{
G_bIsHuman[client] = true;
G_bIsZombie[client] = false;
2018-07-23 10:51:04 +02:00
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
2018-07-23 10:51:04 +02:00
{
for (new client = 1; client <= MaxClients; client++)
2018-07-23 10:51:04 +02:00
{
G_bIsHuman[client] = true;
G_bIsZombie[client] = false;
2018-07-23 10:51:04 +02:00
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
2018-07-23 10:51:04 +02:00
{
switch(GetEventInt(event, "winner"))
2018-07-23 10:51:04 +02:00
{
case(CS_TEAM_CT): CreateTimer(0.2, OnHumansWin, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
2018-07-23 10:51:04 +02:00
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
2018-07-23 10:51:04 +02:00
public Action:OnHumansWin(Handle:timer)
{
for (new client = 1; client <= MaxClients; client++)
2018-07-23 10:51:04 +02:00
{
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
{
if (G_bIsHuman[client] && !G_bIsZombie[client])
{
CS_SetMVPCount(client, CS_GetMVPCount(client) + 1);
}
}
}
}