Raised This Month: $32 Target: $400
 8% 

Force FakeClients to Attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pepperoniego
New Member
Join Date: Aug 2020
Old 04-24-2021 , 17:34   Force FakeClients to Attack
Reply With Quote #1

Hello, I'm trying to make fakeclients crouch and shoot when I type .attack in chat, It only works randomly after I type the command a lot of times (at least >20). Anyone knows how to fix this?

PHP Code:
bool g_BotCrouching[MAXPLAYERS 1];

//function called in .attack
stock bool ForceAttack(int clientint index = -1) {
  
int bot GetClientBot(clientindex);
  if (
bot 0) {
    
g_BotCrouching[bot]=true;
    return 
true;
  }
  return 
false;
}

public 
Action OnPlayerRunCmd(int clientintbuttonsintimpulsefloat vel[3], float angles[3],
                      
intweaponintsubtypeintcmdnuminttickcountintseed,
                      
int mouse[2]) {
  if (
client && IsClientInGame(client) && IsFakeClient(client)) {
    if (
g_BotCrouching[client]) {
      
buttons |= IN_DUCK//this works
      
buttons |= IN_ATTACK;
      
CreateTimer(3.0Timer_ShouldAttackGetClientSerial(client));
      return 
Plugin_Changed;
    } else {
      
buttons &= ~IN_DUCK;
      
buttons &= ~IN_ATTACK;
    }
  }
  return 
Plugin_Continue;
}

public 
Action Timer_ShouldAttack(Handle timerint serial) {
    
int client GetClientFromSerial(serial);
    
g_BotCrouching[client] = false;
    return 
Plugin_Handled;

Im using splewi's csgo practice mode fakeclients btw

Last edited by Pepperoniego; 04-25-2021 at 00:57.
Pepperoniego is offline
Pepperoniego
New Member
Join Date: Aug 2020
Old 04-26-2021 , 00:31   Re: Force FakeClients to Attack
Reply With Quote #2

I have found the problem, every time I spectate the fakeclients they make the animation of pulling out their weapons, however after switching back and forth to first person many times they dont make the animation anymore, and thats exactly when the bots can shoot with my command.

This explains better:

https://imgur.com/a/29nWrsj

Does anybody know why is this happening?

Last edited by Pepperoniego; 04-26-2021 at 00:32.
Pepperoniego is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 04-26-2021 , 14:55   Re: Force FakeClients to Attack
Reply With Quote #3

There are 2 puppet mods available somewhere here for CS:S servers. You cold try them, if they work for CS:GO, you could copy the implementation of shooting from them.

Last edited by kadet.89; 04-26-2021 at 14:56.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Pepperoniego
New Member
Join Date: Aug 2020
Old 04-27-2021 , 12:31   Re: Force FakeClients to Attack
Reply With Quote #4

Still taking several minutes until they stop making that animation, its like they were switching weapons or didnt have a weapon at all.
Pepperoniego is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:08.


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