GTAGaming Forums

GTAGaming Forums (http://www.gtagaming.com/forums/index.php)
-   Grand Theft Auto IV Mods (http://www.gtagaming.com/forums/forumdisplay.php?f=318)
-   -   Help Teleport to waypoint (http://www.gtagaming.com/forums/showthread.php?t=113625)

jiahsuan 02-21-2009 03:19 PM

Help Teleport to waypoint
 
Code:

int __cdecl GET_BLIP_COORDS(int a1, int a2)  //0x00A0C430
{
int v2; // eax@1
int result; // eax@5

v2 = sub_7B53E0(a1);
if ( v2 < 0 )
{
  result = a2;
  __asm
  {
    xorps  xmm0, xmm0
    movss  dword ptr [eax+8], xmm0
    movss  dword ptr [eax+4], xmm0
    movss  dword ptr [eax], xmm0
  }
}
else
{
  _EAX = dword_FB1AF0[v2];
  if ( *(_BYTE *)(_EAX + 8) )
  {
    __asm
    {
      movss  xmm0, dword ptr [eax+30h]
      movss  xmm1, dword ptr [eax+34h]
      movss  xmm2, dword ptr [eax+38h]
    }
  }
  else
  {
    __asm
    {
      movss  xmm0, dword ptr [eax+1Ch]
      movss  xmm1, dword ptr [eax+20h]
      xorps  xmm2, xmm2
    }
  }
  result = a2;
  __asm
  {
    movss  dword ptr [eax], xmm0
    movss  xmm0, [esp+10h+var_4]
    movss  dword ptr [eax+4], xmm1
    movss  dword ptr [eax+8], xmm2
    movss  dword ptr [eax+0Ch], xmm0
  }
}
return result;
}

<!--c2--><!--ec2-->

<!--c1-->





<!--ec1-->
  int const *Blips = (int*)0x00FB1AF0;  //Blips On The Map
  isWpOn = false;

  for(int j = 0; j<50; j++)          //I dont know the limit of the array...
  {
      if(Blips[j] != 0)
      {
              Wpx = *(float*)(Blips[j] + 0x30);
              Wpy = *(float*)(Blips[j] + 0x34);
              Wpz = *(float*)(Blips[j] + 0x38);
      }

      if(Wpz == 0) break;        //It is waypoint. Maybe better solution like blip name.
  }

  if(isWpOn) PrintText(m_font, "Press F12 For Teleport (%d, %d, %d)", (int)Wpx, (int)Wpy, (int)Wpz); //It is my  function to write text to screen.
<!--c2-->

how can make it to ASI ? thanks

rappo 02-22-2009 12:54 AM

There seems to be a problem with the GET_BLIP_COORDS function in the script hooks available. I tried making this mod as well, but the messed up function didn't allow me to. Here's the code I used, maybe you can figure something out (it's C++):

this code was used to figure out what all of the blip info ID's were. 8 = waypoint

Code:

void CustomFiberThread::RunScript() {
        while(IsThreadAlive()) {
                if(!firstRun) {
                        niko = GetPlayerPed();
                        nikoIndex = GetPlayer();
                        firstRun = true;
                }

                if((GetAsyncKeyState(VK_F9) && 1) != 0) {
                        for(u32 i = 0; i <= 1000; i++) {
                                waypoint = GetFirstBlipInfoId(i);
                                while(DoesBlipExist(waypoint)) {
                                        waypointCoords = BlipCoords(waypoint);
                                        //GetBlipCoords(waypoint, &waypointCoords);
                                       
                                        char buffer[1024];
                                        sprintf_s(buffer, "Info ID (%d) - %s: %f %f %f", i, GetBlipName(waypoint), waypointCoords.X, waypointCoords.Y, waypointCoords.Z);
                                        LogInfo(buffer);

                                        SetCharCoordinates(niko, waypointCoords.X, waypointCoords.Y, waypointCoords.Z);
                                        waypoint = GetNextBlipInfoId(i);
                                        //break;
                                }
                        }
                }

                Wait(100);
        }
}

Vector3 CustomFiberThread::BlipCoords(Blip b) {
        f32 x, y, z;
        Vector3 coords;
        Vehicle v;
        Ped p;
        Object o;
        Pickup pi;

        eBlipType blipType = GetBlipInfoIdType(b);
       
        switch(blipType) {
                case BLIP_TYPE_CAR:
                        v = GetBlipInfoIdCarIndex(b);
                        GetCarCoordinates(v, &x, &y, &z);
                break;

                case BLIP_TYPE_CHAR:
                        p = GetBlipInfoIdPedIndex(b);
                        GetCharCoordinates(p, &x, &y, &z);
                break;

                case BLIP_TYPE_OBJECT:
                        o = GetBlipInfoIdObjectIndex(b);
                        GetObjectCoordinates(o, &x, &y, &z);
                break;

                case BLIP_TYPE_PICKUP:
                        pi = GetBlipInfoIdPickupIndex(b);
                        GetPickupCoordinates(pi, &x, &y, &z);
                break;

                case BLIP_TYPE_COORD:
                default:
                        GetBlipCoords(b, &coords);
                break;
        }

        if(coords.X == 0) {
                coords.X = x;
                coords.Y = y;
                coords.Z = z;
        }

        return coords;
}


jiahsuan 02-22-2009 03:45 AM

this code from this mod:
http://www.gtaforums.com/index.php?showtopic=389609

I just want teleport to waypoint funtion in GTA4 1.0.2.0
No any mod or trainer have this funtion

sjaak327 02-22-2009 03:55 AM

That's because the c++ scripthook returns zero if you try to get the waypoint's position, the same for the dotnet scripthook since it's based on the c++ scripthook. Never tried it with alice.

xddj 08-20-2009 01:16 AM

Quote:

Originally Posted by sjaak327 (Post 1951720)
That's because the c++ scripthook returns zero if you try to get the waypoint's position, the same for the dotnet scripthook since it's based on the c++ scripthook. Never tried it with alice.

I do not understand the "return 0". Someone could tell me what that means?
What I could do with Alice that I could not do with Scripthook?

sjaak327 08-24-2009 03:23 PM

It means that whilst getten the X,Y and Z position of the waypoint, they were returned as 0, meaning worthless, cannot be used to teleport to.

In fact this issue has been fixed in later versions of the scripthook, so that now teleport to waypoint is fully possible.


All times are GMT -6. The time now is 06:28 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.