Пример #1
0
cell AMX_NATIVE_CALL Natives::AttachTrailerToDynamicVehicle(AMX *amx, cell *params)
{
	CHECK_PARAMS(2, "AttachTrailerToDynamicVehicle");
	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, Item::SharedVehicle>::iterator v2 = core->getData()->vehicles.find(static_cast<int>(params[2]));
		if (v2 != core->getData()->vehicles.end())
		{
			boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.find(v->first);
			if (i != core->getData()->internalVehicles.end())
			{
				boost::unordered_map<int, int>::iterator i2 = core->getData()->internalVehicles.find(v2->first);
				if (i2 != core->getData()->internalVehicles.end())
				{
					AttachTrailerToVehicle(i2->second, i->second);
					return 1;
				}
			}
		}
	}
	return 0;
}
Пример #2
0
	bool AttachTrailer(int trailerid) const
		{ return AttachTrailerToVehicle(trailerid, id_); }