cell AMX_NATIVE_CALL Natives::GetDynamicVehicleTrailer(AMX *amx, cell *params)
{
	CHECK_PARAMS(1, "GetDynamicVehicleTrailer");
	boost::unordered_map<int, Item::SharedVehicle>::iterator v = core->getData()->vehicles.find(static_cast<int>(params[1]));
	if (v != core->getData()->vehicles.end())
	{
		boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.find(v->first);
		if (i != core->getData()->internalVehicles.end())
		{
			int trailerid = GetVehicleTrailer(i->second);
			for (boost::unordered_map<int, int>::iterator j = core->getData()->internalVehicles.begin(); j != core->getData()->internalVehicles.end(); j++)
			{
				if (j->second == trailerid)
				{
					return j->first;
				}
			}
			return 0;
		}
		return 0;
	}
	return 0;
}
Beispiel #2
0
	int GetTrailer() const
		{ return GetVehicleTrailer(id_); }