Objective Markers in m0d_sa

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
Hi, How would I put objective marker above a vehicle in m0d_sa, I don't know it because I haven't digged in the game and game_sa files..
thanks!


I found this: g_SAMP->pPools->pVehicle->pSAMP_Vehicle[vid]->byteIsObjective = true;
it works fine but I don't know how and where should I disable it.. I want to do it like something....
When I hold LBUTTON then a marker on the nearest vehicle appears but I don't know how should I disable it.. I have successfully done it till enabling the marker and now where should I disable it, It should disable when I stop holding LBUTTON
this is my current code, but I think if the car/actor tps or goes away then the marker will stay isnt it?
[shcode=cpp]
if(nearest_id != -1)
{
if(nearest->vehicle != nullptr)
{
if(KEY_DOWN(VK_LBUTTON))
{
int vid = getSAMPVehicleIDFromGTAVehicle(nearest->vehicle);
g_SAMP->pPools->pVehicle->pSAMP_Vehicle[vid]->byteIsObjective = true;
}
else
{
int vid = getSAMPVehicleIDFromGTAVehicle(nearest->vehicle);
g_SAMP->pPools->pVehicle->pSAMP_Vehicle[vid]->byteIsObjective = false;
}
}
}
[/shcode]
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
Update: This is my new and full code, I took this from cheat_actor.cpp the cheat_handle_aimbot function and modified it(I wanted to get nearest actor/ped)
Code:
if (g_SAMP == NULL) return;
	traceLastFunc("cheat_lagtroll()");

	struct actor_info	*nearest;	

	// get the camera
	CCamera *pCamera = pGame->GetCamera();

	// grab the active cam
	CCamSAInterface *pCam = (CCamSAInterface *)((CCamSA *)pCamera->GetCam(pCamera->GetActiveCam()))->GetInterface();
	int nearest_id = -1;
	nearest_id = actor_find_nearest_ex(ACTOR_ALIVE, [pCam](actor_info *ainfo)
	{
		CVector src = pCam->Source;
		CPed *ped = pGame->GetPools()->GetPed((DWORD *)ainfo);
		if (ped == nullptr)
			return false;

		return true;
	});

	if (nearest_id == -1)
		return;

	if ((nearest = actor_info_get(nearest_id, ACTOR_ALIVE)) == nullptr)
	{
		nearest_id = -1;
		return;
	}

	CPed *ped = pGame->GetPools()->GetPed((DWORD *)nearest);
	if (ped == nullptr)
	{
		nearest_id = -1;
		return;
	}
if(nearest_id != -1)
	{
		if(nearest->vehicle != nullptr)
		{
			if(KEY_DOWN(VK_RBUTTON))
			{
			  //My secret codenz here

					
				}
				else
				{
					int vid = getSAMPVehicleIDFromGTAVehicle(nearest->vehicle);
					lastVehIdLagTroll = vid;
				}
			}
			else
			{
				if(g_SAMP->pPools->pVehicle->iIsListed[lastVehIdLagTroll]) g_SAMP->pPools->pVehicle->pSAMP_Vehicle[lastVehIdLagTroll]->byteIsObjective = false;
				return;
			}
		}
		else
		{
			if(g_SAMP->pPools->pVehicle->iIsListed[lastVehIdLagTroll]) g_SAMP->pPools->pVehicle->pSAMP_Vehicle[lastVehIdLagTroll]->byteIsObjective = false;
			return;
		}
	}
	else
	{
		if(g_SAMP->pPools->pVehicle->iIsListed[lastVehIdLagTroll]) g_SAMP->pPools->pVehicle->pSAMP_Vehicle[lastVehIdLagTroll]->byteIsObjective = false;
		return;
	}
now the only problem I have here is, if I press the rbutton key aftergetting vehicle and the player of the vehicle is no longer in it, the marker is still on the vehicle and it works and my problem is also that I cant use it inside a vehicle, help please?
 

4changesLeft

Well-known member
Joined
Apr 10, 2015
Messages
365
Reaction score
3
I think what you're trying to say is that when you press the rbutton, it will only work if the player is still on the car? because that is simple, you can put a simple check on the lbutton to see if the nearest car has a driver, and if it doesnt, then disable tha marker and put it on the next car
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
lemme tell it again.. I have made it and it works BUT if I detected a player and was holding rubtton(right mouse) then checkpoint will appear but if the player leaves the car the marker is still on car and If I release it goes away but if I press it again even without any nearby players it will appear checkpoint again on the car lol..
or wait I forgot.
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Why use sa-mp when you have mta interface in mod_sa? Look in CRadar, or look in mta sa source and see how they add markers(100% they have a function for this).
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
springfield said:
Why use sa-mp when you have mta interface in mod_sa? Look in CRadar, or look in mta sa source and see how they add markers(100% they have a function for this).

fyp has done great work  :fuck_yea:
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
0x32789 said:
springfield said:
Why use sa-mp when you have mta interface in mod_sa? Look in CRadar, or look in mta sa source and see how they add markers(100% they have a function for this).

fyp has done great work  :fuck_yea:

What has this to do with FYP? Is your question solved or not?
 
Top