Thread: Money in CS
View Single Post
Re: Money in CS
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Money in CS - 01-10-2006

I don't think it's edict_t keeping money. We are using catching HL messages to get info about the money...

PHP Code:
void pfnMessageBegin (int msg_destint msg_type, const float *pOriginedict_t *ed)
{
   
// Called each Time a Message is about to sent

   
int index;
   
int tab_index;

   
botMsgFunction NULL// no msg function until known otherwise
   
state 0;

   
// Bot involved ?
   
if (!FNullEnt (ed))
   {
      
index ENTINDEX (ed) - 1;

      
// is this message for a bot?
      
if ((index >= 0) && (index gpGlobals->maxClients) && (bots[index].pEdict == ed))
      {
         
botMsgIndex index// index of bot receiving message

         // Message handling is done in bot_client.cpp
         
if (msg_type == GET_USER_MSG_ID (PLID"AmmoPickup"NULL))
            
botMsgFunction BotClient_CS_AmmoPickup;
(...) 
         else if (
msg_type == GET_USER_MSG_ID (PLID"Money"NULL))
            
botMsgFunction BotClient_CS_Money;
(...)
}

void BotClient_CS_Money (void *pint bot_index)
{
   
// This message gets sent when the bots money ammount changes

   
if (state == 0)
      
bots[bot_index].bot_money = *(int *) p;  // amount of money

AMX X hacks private data to set money for the player:
PHP Code:
    // Give money
    
*((int *)pPlayer->pvPrivateData OFFSET_CSMONEY) = params[2]; 
  
Reply With Quote