50 lines
1.2 KiB
SourcePawn
50 lines
1.2 KiB
SourcePawn
|
#include <sourcemod>
|
||
|
#include "loghelper.inc"
|
||
|
|
||
|
#pragma semicolon 1
|
||
|
#pragma newdecls required
|
||
|
|
||
|
public Plugin myinfo =
|
||
|
{
|
||
|
name = "RewardEventWinners",
|
||
|
author = "Neon",
|
||
|
description = "",
|
||
|
version = "1.0",
|
||
|
url = "https://steamcommunity.com/id/n3ontm"
|
||
|
};
|
||
|
|
||
|
public void OnPluginStart()
|
||
|
{
|
||
|
RegAdminCmd("sm_rewardwinners", Command_RewardWinners, ADMFLAG_BAN, "sm_rewardwinners <difficulty>");
|
||
|
}
|
||
|
|
||
|
public void OnMapStart()
|
||
|
{
|
||
|
GetTeams();
|
||
|
}
|
||
|
|
||
|
public Action Command_RewardWinners(int client, int argc)
|
||
|
{
|
||
|
if (argc < 1)
|
||
|
{
|
||
|
ReplyToCommand(client, "[SM] Usage: sm_rewardwinners <difficulty>");
|
||
|
return Plugin_Handled;
|
||
|
}
|
||
|
|
||
|
char sArg[64];
|
||
|
GetCmdArg(1, sArg, sizeof(sArg));
|
||
|
int iDifficulty = StringToInt(sArg);
|
||
|
|
||
|
for (int i = 1; i <= MaxClients; i++)
|
||
|
{
|
||
|
if (IsClientInGame(i) && IsPlayerAlive(i) && !IsClientObserver(i) && !IsFakeClient(i) && (GetClientTeam(i) == 3))
|
||
|
{
|
||
|
char StrEventName[128];
|
||
|
Format(StrEventName, sizeof(StrEventName), "event_win_%d", iDifficulty);
|
||
|
//PrintToChatAll(StrEventName);
|
||
|
LogPlayerEvent(i, "triggered", StrEventName);
|
||
|
LogAction(client, -1, "\"%L\" rewarded \"%L\" for winning an event (difficulty: %d).", client, i, iDifficulty);
|
||
|
}
|
||
|
}
|
||
|
return Plugin_Handled;
|
||
|
}
|