View Single Post
Author Message
Xeller_2
New Member
Join Date: Feb 2024
Old 02-01-2024 , 07:43   [CS:S] Stop bots from going knife at the start of a round
Reply With Quote #1

So, i'm trying to stop bots from going knife at the start of a round, because that creates problems when playing on aim and fy maps, this is my first sourcemod coding experience and this is what i have so far, it does not even work:

#include <sourcemod>
#include <cstrike>
#include <sdktools_functions>

public Plugin myinfo =
{
name = "BotSwitchPrimary",
author = "Xeller",
description = "Switches fakeclients to primary weapon on round start",
version = "1.0",
};

public void OnPluginStart()
{
HookEvent("player_spawn", EventSpawn);
}

public void EventSpawn(Event event, const char[] name, bool bdb)
{
int client = GetEventInt(event, "userid");

if (IsFakeClient(client))
{
new weapon = GetPlayerWeaponSlot(client, 1);
SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon)
}
}

If anyone knows how to do it properly i would greatly appreciate the help.
Xeller_2 is offline