Results 1 to 3 of 3
  1. #1
    hackeverything's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    198
    My Mood
    Cold

    Compiling Sauerbraten Aimbot?!?!

    I'm making an aimbot for Sauerbraten. It is taking me forever. I am stuck. I am adding code to engine/rendergl.cpp.
    Here's my code: (it goes on, i didn't want to post 2000+ lines)

    Code:
    // rendergl.cpp: core opengl rendering stuff
    #include "engine.h"
    #include "game.h"  // added to define most stuff and for the namespaces
    bool hasVBO = false, hasDRE = false, hasOQ = false, hasTR = false, hasFBO = false, hasDS = false, hasTF = false, hasBE = false, hasBC = false, hasCM = false, hasNP2 = false, hasTC = false, hasTE = false, hasMT = false, hasD3 = false, hasAF = false, hasVP2 = false, hasVP3 = false, hasPP = false, hasMDA = false, hasTE3 = false, hasTE4 = false, hasVP = false, hasFP = false, hasGLSL = false, hasGM = false, hasNVFB = false, hasSGIDT = false, hasSGISH = false, hasDT = false, hasSH = false, hasNVPCF = false, hasRN = false, hasPBO = false, hasFBB = false, hasUBO = false, hasBUE = false, hasFC = false, hasTEX = false;
    int hasstencil = 0;
    int lasttarget = -1;  //part of the aimbot
    float lastdist = 0.0f;//part of the aimbot
    VAR(renderpath, 1, 0, 0);
    #define MINBORD 2 //mod
    #define OUTBORD(x,y) ((x)<MINBORD || (y)<MINBORD || (x)>=ssize-MINBORD || (y)>=ssize-MINBORD) //mod
    struct traceresult_s // pulled from AssaultCube
    {
         vec end;
         bool collided;
    };
    
    void TraceLine(vec from, vec to, dynent *pTracer, bool CheckPlayers, traceresult_s *tr, // pulled from AssaultCube, but being modded to fit into Sauerbraten
                   bool SkipTags)                                                           //
    {
         using entities::ents;          // namespace entities in game.h (mod)
         int ssize;                     // declares ssize (mod)
         tr->end = from;
         tr->collided = false;
    
         static float flNearestDist, flDist;
         static vec v;
         static bool solid;
    
         flNearestDist = 9999.0f;
    
         if(OUTBORD((int)from.x, (int)from.y)) return;
    
         // Check if the 'line' collides with entities like mapmodels
         loopv(ents)
         {
              entity &e = ents[i];            //   CAUSES ERROR
              if(e.type!=MAPMODEL) continue; // Only check map models for now
    
              mapmodelinfo &mmi = getmminfo(e.attr2);
              if(!&mmi || !mmi.h) continue;
    
              float lo = (float)(S(e.x, e.y)->floor+mmi.zoff+e.attr3);
              float hi = lo+mmi.h;
              float z = (fabs(from.z-lo) < fabs(from.z-hi)) ? lo : hi;
              makevec(&v, e.x, e.y, z);
              flDist = GetDistance(from, v);
    
              if ((flDist < flNearestDist) && (intersect(&e, from, to, &tr->end)))
              {
                   flNearestDist = GetDistance(from, tr->end);
                   tr->collided = true;
              }
         }
    
         if (CheckPlayers)
         {
              // Check if the 'line' collides with players
              loopv(players)
              {
                   playerent *d = players[i];
                   if(!d || (d==pTracer) || (d->state != CS_ALIVE)) continue; // Only check valid players
    
                   flDist = GetDistance(from, d->o);
    
                   if ((flDist < flNearestDist) && (intersect(d, from, to, &tr->end)))
                   {
                        flNearestDist = flDist;
                        tr->collided = true;
                   }
              }
    
              // Check if the 'line' collides with the local player(player1)
              playerent *d = player1; // Shortcut
              if (d && (d!=pTracer) && !BotManager.m_pBotToView && (d->state == CS_ALIVE))
              {
                   flDist = GetDistance(from, d->o);
    
                   if ((flDist < flNearestDist) && (intersect(d, from, to, &tr->end)))
                   {
                        flNearestDist = flDist;
                        tr->collided = true;
                   }
              }
         }
    
    
         float dx = to.x-from.x;
         float dy = to.y-from.y;
         int steps = (int)(sqrt(dx*dx+dy*dy)/0.9);
         if(!steps) // If from and to are on the same cube...
         {
              if (GetDistance(from, to) < flNearestDist)
              {
                   tr->end = to;
                   sqr *s = S(int(from.x), int(from.y));
                   float flr = GetCubeFloor(int(from.x), int(from.y));
                   solid = ((!SkipTags || !s->tag) && SOLID(s));
                   if (solid || (to.z < flr) || (to.z > s->ceil))
                   {
                        tr->collided = true;
                        tr->end.z = (fabs(to.z-s->ceil) < fabs(to.z-flr)) ? s->ceil : flr;
                   }
              }
              return;
         }
    
         float x = from.x;
         float y = from.y;
         int i = 0;
         vec endcube = from;
    
         // Now check if the 'line' is hit by a cube
         while(i<steps)
         {
              if(OUTBORD((int)x, (int)y)) break;
              if (GetDistance(from, endcube) >= flNearestDist) break;
              sqr *s = S(int(x), int(y));
              solid = ((!SkipTags || !s->tag) && SOLID(s));
              if(solid) break;
              float floor = s->floor;
              if(s->type==FHF) floor -= s->vdelta/4.0f;
              float ceil = s->ceil;
              if(s->type==CHF) ceil += s->vdelta/4.0f;
              float rz = from.z-((from.z-to.z)*(i/(float)steps));
              if(rz<floor || rz>ceil) break;
    
              endcube.x = x;
              endcube.y = y;
              endcube.z = rz;
              x += dx/(float)steps;
              y += dy/(float)steps;
              i++;
         }
    
         if ((i>=steps) && !tr->collided)
         {
              tr->end = to;
         }
         else
         {
              tr->collided = true;
              if (GetDistance(from, endcube) < flNearestDist)
                   tr->end = endcube;
         }
    
         return;
    }
    However, when I try to compile it, I get this:
    Code:
    engine/rendergl.cpp:37:29: error: invalid initialization of reference of type ‘entity&’ from expression of type ‘extentity*’
    And a whole lot of other errors I plan to fix later. This question may seem obvious or dumb or something else, but:
    Can someone help me clear this errror? it is here:
    Code:
     entity &e = ents[i];            //   CAUSES ERROR
    If this request/question was stupid, please excuse me, i am a C++ novice and have only gotten this far by spending a large amount of time on it
    Thank you in advance for making a fast and helpful reply!
    P.S. The whole file engine/rendergl.cpp I posted here: [C++] engine/rendergl.cpp - Pastebin.com

  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Try extentity &e = ents[i];

    or change it to entity *e = ents[i]; assuming entity is derived from extentity
    Last edited by Hell_Demon; 10-30-2011 at 05:39 AM.
    Ah we-a blaze the fyah, make it bun dem!

  3. #3
    hackeverything's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    16
    Reputation
    10
    Thanks
    198
    My Mood
    Cold
    Thanks, that worked. Well.
    Thanks for helping!

Similar Threads

  1. [Help] Want an aimbot hack for Cube 2 Sauerbraten
    By hackeverything in forum General Game Hacking
    Replies: 1
    Last Post: 11-22-2011, 10:39 PM
  2. Hacks for Warrock (Aimbot, Wallhack)
    By Clarity in forum WarRock - International Hacks
    Replies: 32
    Last Post: 01-19-2006, 05:30 PM
  3. GPS Aimbot
    By Paolo1993 in forum Hack Requests
    Replies: 0
    Last Post: 01-09-2006, 03:10 AM
  4. Looking for a good Lisp compiler
    By Zededarian in forum Programming
    Replies: 3
    Last Post: 01-04-2006, 06:19 PM
  5. America's Army aimbot
    By garebear in forum General Game Hacking
    Replies: 6
    Last Post: 12-30-2005, 04:52 PM