cell AMX_NATIVE_CALL Natives::GetDynamicVehComponentInSlot(AMX *amx, cell *params)
{
	CHECK_PARAMS(2, "GetDynamicVehComponentInSlot");
	boost::unordered_map<int, Item::SharedVehicle>::iterator v = core->getData()->vehicles.find(static_cast<int>(params[1]));
	int ret = 0;
	if (v != core->getData()->vehicles.end())
	{
		int slot = static_cast<int>(params[2]);
		boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.find(v->first);
		if (i != core->getData()->internalVehicles.end())
		{
			ret = GetVehicleComponentInSlot(i->second, slot);
		}
		else
		{
			try
			{
				ret = v->second->carmods.at(slot);
			}
			catch (...)
			{
				ret = 0;
			}
		}
	}
	return ret;
}
Beispiel #2
0
	int GetComponentInSlot(int slot) const
		{ return GetVehicleComponentInSlot(id_, slot); }