コード例 #1
0
PLUGIN_EXPORT bool PLUGIN_CALL OnVehicleDamageStatusUpdate(int vehicleid, int playerid)
{
	for (boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.begin(); i != core->getData()->internalVehicles.end(); ++i)
	{
		if (i->second == vehicleid)
		{
			for (std::set<AMX*>::iterator a = core->getData()->interfaces.begin(); a != core->getData()->interfaces.end(); ++a)
			{
				int amxIndex = 0;
				if (!amx_FindPublic(*a, "OnDynamicVehDamageStatusUpdate", &amxIndex))
				{
					amx_Push(*a, static_cast<cell>(playerid));
					amx_Push(*a, static_cast<cell>(i->first));
					amx_Exec(*a, NULL, amxIndex);
				}
			}
			boost::unordered_map<int, Item::SharedVehicle>::iterator p = core->getData()->vehicles.find(i->first);
			if (p != core->getData()->vehicles.end())
			{		
				/*
				if (!p->second->touched)
				{
					p->second->touched = true;
					core->getStreamer()->movingVehicles.insert(p->second);
				}
				*/
				p->second->lastUpdatedTick = GetTickCount();
				GetVehicleDamageStatus(i->first, &p->second->panels, &p->second->doors, &p->second->lights, &p->second->tires);
			}
			break;
		}
	}
	return true;
}
コード例 #2
0
cell AMX_NATIVE_CALL Natives::GetDynamicVehicleDamageStatus(AMX *amx, cell *params)
{
	CHECK_PARAMS(5, "GetDynamicVehicleDamageStatus");
	boost::unordered_map<int, Item::SharedVehicle>::iterator v = core->getData()->vehicles.find(static_cast<int>(params[1]));
	if (v != core->getData()->vehicles.end())
	{
		int panels, doors, lights, tires;
		boost::unordered_map<int, int>::iterator i = core->getData()->internalVehicles.find(v->first);
		if (i != core->getData()->internalVehicles.end())
		{
			GetVehicleDamageStatus(i->second, &panels, &doors, &lights, &tires);
		}
		else
		{
			panels = v->second->panels;
			doors = v->second->doors;
			lights = v->second->lights;
			tires = v->second->tires;
		}
		Utility::storeIntegerInNative(amx, params[2], panels);
		Utility::storeIntegerInNative(amx, params[3], doors);
		Utility::storeIntegerInNative(amx, params[4], lights);
		Utility::storeIntegerInNative(amx, params[5], tires);
		return 1;
	}
	return 0;
}
コード例 #3
0
ファイル: a_vehicles.hpp プロジェクト: Tumba/Keeper
	bool GetDamageStatus(int &panels, int &doors, int &lights, int &tires) const
		{ return GetVehicleDamageStatus(id_, &panels, &doors, &lights, &tires); }
コード例 #4
0
ファイル: a_vehicles.hpp プロジェクト: Tumba/Keeper
	bool GetDamageStatus(int *panels, int *doors, int *lights, int *tires) const
		{ return GetVehicleDamageStatus(id_, panels, doors, lights, tires); }