Raised This Month: $ Target: $400
 0% 

Get cz bots to stop when shooting


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LukeyB
Member
Join Date: Dec 2011
Old 12-15-2011 , 10:39   Get cz bots to stop when shooting
Reply With Quote #1

I'm trying to get cz bots to stop when shooting to increase their accuracy, then continue to move as normal. I have got it to where they will stop when shooting but can't move again. Here is what I have so far.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
// any of the buttons on the right will count as moving
#define IN_MOVING (IN_FORWARD|IN_BACK|IN_MOVELEFT|IN_MOVERIGHT| IN_JUMP)
// Tracks players Shots-Fired: [0]=WeaponID, [1]=Ammo
new g_iCurrWeapon[33][2]
public 
plugin_init()
{
register_event"CurWeapon""Event_ShotFired""b" )
}
public 
Event_ShotFiredid )
{
// Players current weapon data..
new wID read_data)
new 
wAmmo read_data)
if( 
g_iCurrWeapon[id][0] != wID // User Changed Weapons..
{
g_iCurrWeapon[id][0] = wID
g_iCurrWeapon
[id][1] = wAmmo
return PLUGIN_CONTINUE
}
if( 
g_iCurrWeapon[id][1] < wAmmo // User Reloaded..
{
g_iCurrWeapon[id][1] = wAmmo
return PLUGIN_CONTINUE
}
if( 
g_iCurrWeapon[id][1] == wAmmo // User did something else, but didn't shoot..
{
return 
PLUGIN_CONTINUE
}
// This far means user shot his/her gun..
// Save new weapon data..
g_iCurrWeapon[id][1] = wAmmo
g_iCurrWeapon
[id][0] = wID
// Do Stuff here..
// he is alive and using movement keys
if( is_user_alive(id) && is_user_bot(id) && (pev(idpev_button) & IN_MOVING) )
{
// make sure he is using a gun
if( wID != CSW_HEGRENADE && wID != CSW_FLASHBANG && wID != CSW_SMOKEGRENADE
&& wID != CSW_C4 && wID != CSW_KNIFE )
{
set_user_maxspeedid 0.1)
}
}
return 
PLUGIN_CONTINUE

LukeyB is offline
 



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 12:04.


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