cell AMX_NATIVE_CALL Natives::CreateDynamicMapIcon(AMX *amx, cell *params) { CHECK_PARAMS(11, "CreateDynamicMapIcon"); if (core->getData()->getGlobalMaxItems(STREAMER_TYPE_MAP_ICON) == core->getData()->mapIcons.size()) { return 0; } int mapIconID = Item::MapIcon::identifier.get(); Item::SharedMapIcon mapIcon(new Item::MapIcon); mapIcon->amx = amx; mapIcon->mapIconID = mapIconID; mapIcon->originalStreamDistance = -1.0f; mapIcon->position = Eigen::Vector3f(amx_ctof(params[1]), amx_ctof(params[2]), amx_ctof(params[3])); mapIcon->type = static_cast<int>(params[4]); mapIcon->color = static_cast<int>(params[5]); Utility::addToContainer(mapIcon->worlds, static_cast<int>(params[6])); Utility::addToContainer(mapIcon->interiors, static_cast<int>(params[7])); Utility::addToContainer(mapIcon->players, static_cast<int>(params[8])); mapIcon->streamDistance = amx_ctof(params[9]) < STREAMER_STATIC_DISTANCE_CUTOFF ? amx_ctof(params[9]) : amx_ctof(params[9]) * amx_ctof(params[9]); mapIcon->style = static_cast<int>(params[10]); Utility::addToContainer(mapIcon->areas, static_cast<int>(params[11])); core->getGrid()->addMapIcon(mapIcon); core->getData()->mapIcons.insert(std::make_pair(mapIconID, mapIcon)); return static_cast<cell>(mapIconID); }
int Natives::CreateDynamicMapIcon(float x, float y, float z, int type, int color, int worldid, int interiorid, int playerid, float streamdistance, int style) { if (core->getData()->getMaxItems(STREAMER_TYPE_MAP_ICON) == core->getData()->mapIcons.size()) { return 0; } int mapIconID = Item::MapIcon::identifier.get(); Item::SharedMapIcon mapIcon(new Item::MapIcon); mapIcon->mapIconID = mapIconID; mapIcon->position = Eigen::Vector3f(x, y, z); mapIcon->type = type; mapIcon->color = color; Utility::addToContainer(mapIcon->worlds, worldid); Utility::addToContainer(mapIcon->interiors, interiorid); Utility::addToContainer(mapIcon->players, playerid); mapIcon->streamDistance = streamdistance * streamdistance; mapIcon->style = style; core->getGrid()->addMapIcon(mapIcon); core->getData()->mapIcons.insert(std::make_pair(mapIconID, mapIcon)); return mapIconID; }