I have a plugin that rewards players who captured (past tense) a control point. It wouldn't take much to change the hooked captured event to something more to your liking, as long as it lists the person(s) capping, like "teamplay_point_startcapture". Here's a link to Team Fortress 2 Events:
https://wiki.alliedmods.net/Team_Fortress_2_Events
This particular plugin rewards every human player who captured the objective with $500 cash (I use money in my server), 5 seconds of a few nice buff conditions, a short visual effect, and a cheer sound heard by the cappers.
Note: I never would have been able to make this plugin without the help of the very talented Bacardi.
Code:
PHP Code:
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
#define CHEER "/ambient_mp3/bumper_car_cheer3.mp3"
public Plugin myinfo =
{
name = "[TF2] Who Captured the Point",
author = "PC Gamer, with help from Bacardi",
description = "Show who captured the control point",
version = PLUGIN_VERSION,
url = "www.sourcemod.com"
}
public void OnPluginStart()
{
HookEvent("teamplay_point_captured", teamplay_point_captured);
}
public void OnMapStart()
{
PrecacheSound(CHEER);
}
public void teamplay_point_captured(Event event, char[] name, bool dontBroadcast)
{
char cappers[32]; // example, event output "cappers" string: \x01\x02\x03
int client_index;
char message[200];
event.GetString("cappers", cappers, sizeof(cappers));
int cappers_count = strlen(cappers);
int[] cappers_array = new int[cappers_count]; // store client indexs
for(int x = 0; x < cappers_count; x++)
{
client_index = view_as<int>(cappers[x]);
Format(message, sizeof(message), "%s, %N", message, client_index);
cappers_array[x] = client_index;
}
PrintToServer("%s captured control point", message[2]);
for(int y = 0; y < cappers_count; y++)
{
if(!IsFakeClient(cappers_array[y]))
{
PrintToServer("%N is a Human who capped a control point", cappers_array[y]);
ServerCommand("sm_addcash #%d 500", GetClientUserId(cappers_array[y]));
ServerCommand("sm_addcond #%d 26 5", GetClientUserId(cappers_array[y]));
ServerCommand("sm_addcond #%d 29 5", GetClientUserId(cappers_array[y]));
ServerCommand("sm_addcond #%d 16 5", GetClientUserId(cappers_array[y]));
ServerCommand("sm_addcond #%d 6 5", GetClientUserId(cappers_array[y]));
PrintToChat(cappers_array[y], "Enjoy Bonuses for capping the control point");
PrintToServer("Gave Capture Bonuses to %N", cappers_array[y]);
EmitSoundToClient(cappers_array[y], CHEER);
}
}
}