#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma newdecls required
public Plugin myinfo =
{
name = "",
author = "",
description = "",
version = "",
url = ""
};
static const char g_szPistols[][] = {
"weapon_usp",
"weapon_glock",
"weapon_p228",
"weapon_deagle",
"weapon_elite",
"weapon_fiveseven"
};
public void OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
int ct[MAXPLAYERS];
int total = 0;
for (int client = 1; client <= MaxClients; client++)
{
if(!IsClientInGame(client) || !IsPlayerAlive(client) || GetClientTeam(client) != CS_TEAM_CT)
continue;
ct[total++] = client;
}
if(total == 0)
return;
int rand_ct = ct[GetRandomInt(0, total - 1)];
int weapon = GetPlayerWeaponSlot(rand_ct, CS_SLOT_SECONDARY);
if(weapon != -1)
{
RemovePlayerItem(rand_ct, weapon);
AcceptEntityInput(weapon, "Kill");
}
GivePlayerItem(rand_ct, g_szPistols[GetRandomInt(0, sizeof(g_szPistols) - 1)]);
}