예제 #1
0
void CBlipManager::AttachToVehicle(EntityId blipId, EntityId vehicleId) 
{
	if(m_bActive[blipId])
	{
		if(g_pVehicleManager->Exists(vehicleId)) 
		{
			CNetworkVehicle * pVehicle = g_pVehicleManager->Get(vehicleId);
			
			//Remove the position blip
			Scripting::RemoveBlip(m_Blips[blipId].uiBlipIndex);

			//And create one for the vehicle
			Scripting::AddBlipForCar(pVehicle->GetScriptingHandle(), &m_Blips[blipId].uiBlipIndex);

			// Set the blip sprite
			ChangeBlipSprite(m_Blips[blipId].uiBlipIndex, (Scripting::eBlipSprite)m_Blips[blipId].iSprite);

			// Set the blip color
			SetColor(blipId, m_Blips[blipId].uiColor);

			// Set the blip size
			SetSize(blipId, m_Blips[blipId].fSize);

			// Set short-range
			ToggleShortRange(blipId, m_Blips[blipId].bShortRange);

			// Set route
			ToggleRouteBlip(blipId, m_Blips[blipId].bRouteBlip);

			m_Blips[blipId].attachedVehicle = vehicleId;
		}
	}
}
예제 #2
0
void CBlipManager::Create(EntityId blipId, int iSprite, CVector3 vecPosition)
{
	if(blipId >= MAX_BLIPS)
		return;
	// If a blip already exists in this slot delete it
	if(m_bActive[blipId])
		Delete(blipId);

	// Add the blip to the game
	Scripting::AddBlipForCoord(vecPosition.fX, vecPosition.fY, vecPosition.fZ, &m_Blips[blipId].uiBlipIndex);

	// Ensure we have a valid sprite id
	if(iSprite < 0 || iSprite > 94)
		iSprite = 3;

	// Set the blip sprite
	Scripting::ChangeBlipSprite(m_Blips[blipId].uiBlipIndex, (Scripting::eBlipSprite)iSprite);

	// Set the blip color
	SetColor(blipId, 0xFFFFFFFF);

	// Set the blip size
	SetSize(blipId, 1.0f);

	// Set short-range
	ToggleShortRange(blipId, false);

	// Set route
	ToggleRouteBlip(blipId, false);

	// Set name
	SetName(blipId, "");

	m_Blips[blipId].iSprite = iSprite;
	m_Blips[blipId].vecPosition = vecPosition;
	m_Blips[blipId].attachedVehicle = INVALID_ENTITY_ID;
	m_bActive[blipId] = true;
}