View Single Post
Re: doesn't this prevent em buying grenades?
Old
  (#7)
bluebyte
Guest
 
Status:
Posts: n/a
Default Re: doesn't this prevent em buying grenades? - 28-05-2004

I made it like that:

Code:
 	else if (pBot->iBuyCount < 7)
{
	 // Care first about buying Armor
	 if (pBot->iBuyCount == 4)
	 {
		 if ((pBot->pEdict->v.armorvalue == 0) && (pBot->bot_money > 650))
		 {
			if (pBot->bot_money >= 1000)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 2\n");
			 else
				 FakeClientCommand (pEdict, "vesthelm\n");
			}
			else if (pBot->bot_money >= 650)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 1\n");
			 else
				 FakeClientCommand (pEdict, "vest\n");
			}
		 }
	 }
 
	 // Buy Grenade or Defuse Kit
 
		 if (pBot->bot_money >= 300)
		 {
			 int iGrenadeType = RANDOM_LONG (1, 100);
 
			 // Focus on HE Grenades
			 if (iGrenadeType < 75)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 4\n");
				 else
					 FakeClientCommand (pEdict, "hegren\n");
			 }
			 else if (iGrenadeType < 82)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 5\n");
				 else
					 FakeClientCommand (pEdict, "sgren\n");
			 }
			 else
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 3\n");
				 else
					 FakeClientCommand (pEdict, "flash\n");
			 }
	   }
 
// If Defusion Map & Counter buy Defusion Kit
		 if ((g_iMapType & MAP_DE) && (pBot->bot_team == TEAM_CS_COUNTER) && !pBot->b_has_defuse_kit && pBot->bot_money >= 200)
		 {
		 if (g_bIsOldCS15)
		 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 6\n");
		 else
		 FakeClientCommand (pEdict, "defuser\n");
		 }
 
	 pBot->iBuyCount = 0; // Finished Buying
	 return;
}
 
pBot->iBuyCount = 0; // Finished Buying
 
return;
}
I think we'd better separate the money checking part for the grenades from the money checking part of defuse kit. I mean here:

Code:
 
	 // Buy Grenade or Defuse Kit
 
		 if (pBot->bot_money >= 300)
instead of 600. Also I had to remove one of the elses below(in // Finished Buying part). Finally i made them buy a lil bit more HE and a lil bit less SMOKE greandes. I recommend u to take my code instead, to save u some time. U can trust me i have tested this code . So here is the whole stuff ready to copy-paste:

Code:
 // Needs an Item ?
else if (pBot->iBuyCount < 7)
{
	 // Care first about buying Armor
	 if (pBot->iBuyCount == 4)
	 {
		 if ((pBot->pEdict->v.armorvalue == 0) && (pBot->bot_money > 650))
		 {
			if (pBot->bot_money >= 1000)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 2\n");
			 else
				 FakeClientCommand (pEdict, "vesthelm\n");
			}
			else if (pBot->bot_money >= 650)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 1\n");
			 else
				 FakeClientCommand (pEdict, "vest\n");
			}
		 }
	 }
	 // Buy Grenade or Defuse Kit
		 if (pBot->bot_money >= 300)
		 {
			 int iGrenadeType = RANDOM_LONG (1, 100);
			 // Focus on HE Grenades
			 if (iGrenadeType < 75)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 4\n");
				 else
					 FakeClientCommand (pEdict, "hegren\n");
			 }
			 else if (iGrenadeType < 82)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 5\n");
				 else
					 FakeClientCommand (pEdict, "sgren\n");
			 }
			 else
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 3\n");
				 else
					 FakeClientCommand (pEdict, "flash\n");
			 }
	   }
 
// If Defusion Map & Counter buy Defusion Kit
		 if ((g_iMapType & MAP_DE) && (pBot->bot_team == TEAM_CS_COUNTER) && !pBot->b_has_defuse_kit && pBot->bot_money >= 200)
		 {
		 if (g_bIsOldCS15)
		 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 6\n");
		 else
		 FakeClientCommand (pEdict, "defuser\n");
		 }
	 pBot->iBuyCount = 0; // Finished Buying
	 return;
}
pBot->iBuyCount = 0; // Finished Buying
return;
}
Plz note that after these changes the defuse kit became kind of lower-priority, I mean it comes after the grenades. (also note that i added that money checking for the defuse kit to it's if header). I this is how it should be now; since IMHO many players first prefer first buying grenades.

Last edited by bluebyte; 28-05-2004 at 11:31..
  
Reply With Quote