AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:S] Stop bots from going knife at the start of a round (https://forums.alliedmods.net/showthread.php?t=345867)

Xeller_2 02-01-2024 07:43

[CS:S] Stop bots from going knife at the start of a round
 
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.

Bacardi 02-01-2024 08:46

Re: [CS:S] Stop bots from going knife at the start of a round
 
One trick would be, drop knife and "kill" it.

Xeller_2 02-01-2024 08:58

Re: [CS:S] Stop bots from going knife at the start of a round
 
Quote:

Originally Posted by Bacardi (Post 2817176)
One trick would be, drop knife and "kill" it.

How is that done exactly?

Bacardi 02-01-2024 12:33

Re: [CS:S] Stop bots from going knife at the start of a round
 
https://sm.alliedmods.net/new-api/cstrike/CS_DropWeapon


Edit
Here is example, if you want player to use another weapon for example
https://forums.alliedmods.net/showpo...76&postcount=8

Vit_amin 02-01-2024 13:26

Re: [CS:S] Stop bots from going knife at the start of a round
 
Quote:

Originally Posted by Xeller_2 (Post 2817170)
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.

I may writing private plugin, if interesting, welcome to PM


All times are GMT -4. The time now is 01:11.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.