Old 02-21-2009   #1
jiahsuan
Registered User
Newbie Member
 
jiahsuan's Avatar
 
Join Date: Jan 2009
Posts: 2
jiahsuan is an unknown quantity at this point
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
jiahsuan is offline   Reply With Quote
Old 02-22-2009   #2
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,914
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
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;
}
__________________
rappo is offline   Reply With Quote
Old 02-22-2009   #3
jiahsuan
Registered User
Newbie Member
 
jiahsuan's Avatar
 
Join Date: Jan 2009
Posts: 2
jiahsuan is an unknown quantity at this point
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

Last edited by jiahsuan; 02-22-2009 at 03:48 AM..
jiahsuan is offline   Reply With Quote
Old 02-22-2009   #4
sjaak327
Registered User
 
Join Date: Jan 2009
Posts: 26
sjaak327 is on a distinguished roadsjaak327 is on a distinguished roadsjaak327 is on a distinguished road
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.
sjaak327 is offline   Reply With Quote
Old 08-20-2009   #5
xddj
Registered User
Newbie Member
 
Join Date: Jun 2009
Posts: 4
xddj is an unknown quantity at this point
Quote:
Originally Posted by sjaak327 View Post
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?
xddj is offline   Reply With Quote
Old 08-24-2009   #6
sjaak327
Registered User
 
Join Date: Jan 2009
Posts: 26
sjaak327 is on a distinguished roadsjaak327 is on a distinguished roadsjaak327 is on a distinguished road
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.
sjaak327 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 -6. The time now is 05:22 AM.