diff --git a/RewardEventWinners/scripting/RewardEventWinners.sp b/RewardEventWinners/scripting/RewardEventWinners.sp new file mode 100644 index 00000000..f88f5c4c --- /dev/null +++ b/RewardEventWinners/scripting/RewardEventWinners.sp @@ -0,0 +1,50 @@ +#include +#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 "); +} + +public void OnMapStart() +{ + GetTeams(); +} + +public Action Command_RewardWinners(int client, int argc) +{ + if (argc < 1) + { + ReplyToCommand(client, "[SM] Usage: sm_rewardwinners "); + 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; +} \ No newline at end of file