Raised This Month: $ Target: $400
 0% 

Hostage following the player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 05-05-2014 , 02:59   Hostage following the player
Reply With Quote #1

Since couple of years I was using in podbot_mm code this, what I found in AMXMODX used as cs_get_hostage_follow function.

Code:
#if !defined __amd64__
         int following = *((int *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW);
#else
         long following = *((long *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW);
#endif

         if (following == 0)
         {
            if ((HostagesData[i].UserEntIndex > 0) && (HostagesData[i].Alive))
            {
               vecHostPos = pHostage->v.origin;  // KWo - 26.08.2006
               bTakeHostage = true;  // KWo - 26.08.2006

               if (g_i_cv_debuglevel & DEBUG_FL_ENTITIES)
                  ALERT(at_logged, "[DEBUG] UTIL_CheckHostages - Hostage %d lost his user(1).\n", i + 1);
            }
            HostagesData[i].UserEntIndex = 0;
         }
         else
        // Else this is probably a pointer to an entity's edict.
         {
            pEntity = (edict_t*)following;
            if (FNullEnt(pEntity))
            {
               if (g_i_cv_debuglevel & DEBUG_FL_ENTITIES)
                  ALERT(at_logged, "[DEBUG] UTIL_CheckHostages - Unknown error finding hostage parameter.\n");

               HostagesData[i].UserEntIndex = 0;
            }
            else
            {
               HostUser = ENTINDEX(pEntity);
               if (g_i_cv_debuglevel & DEBUG_FL_ENTITIES)  // KWo - 04.05.2014
                  ALERT(at_logged, "[DEBUG] UTIL_CheckHostages - Found hostage's %d usernr - %d.\n", i + 1, HostUser);

               if ((clients[HostUser-1].iFlags & CLIENT_ALIVE) && (clients[HostUser-1].iFlags & CLIENT_USED)
                    && ((clients[HostUser-1].vOrigin - pHostage->v.origin).Length() <= 600.0))
               {
                  HostagesData[i].UserEntIndex = HostUser;

                  if (g_i_cv_debuglevel & DEBUG_FL_ENTITIES)
                     ALERT(at_logged, "[DEBUG] UTIL_CheckHostages - Found hostage's %d user - %s.\n", i + 1, STRING(pEntity->v.netname));
               }
               else
               {
/*
#if !defined __amd64__
                  *((int *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW) = 0;
#else
                  *((long *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW) = 0;
#endif
*/
               }
            }
The code works perfectly with CS1.6, but it doesn't with CZERO. The "following" always returns 0 for CZERO, so this is why my bots cannot detect right if the hostage is already "used" by another bot/player to prevent "steel" it from him or to detect right if the hostage lost his "user". I believe this is so from 2013 CS/CZERO update. I just discovered it accidently after some complains of users of podbot mm concering to something else. I was always testing my bots with CS1.6, because I was reading many times at this board everything in CZERO works the same way like in CS1.6 (except extensions CZERO has) - so I was believeing also all OFFSETS for private data should be the same for both games.
Anybody knows what could happen with these offsets for CZERO? How do You guys are discovering these offsets (I mean which way I can narrow down the right offset for OFFSET_HOSTAGEFOLLOW for CZERO?
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo 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 19:38.


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