cell AMX_NATIVE_CALL Natives::Streamer_SetCellDistance(AMX *amx, cell *params) { CHECK_PARAMS(1, "Streamer_SetCellDistance"); core->getGrid()->setCellDistance(amx_ctof(params[1]) * amx_ctof(params[1])); core->getGrid()->rebuildGrid(); return 1; }
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params) { SETUP(4); Vector v3; Vector v4; float *fl3=(float *)MF_GetAmxAddr(amx, params[3]); v3.x=fl3[0]; v3.y=fl3[1]; v3.z=fl3[2]; float *fl4=(float *)MF_GetAmxAddr(amx, params[4]); v4.x=fl4[0]; v4.y=fl4[1]; v4.z=fl4[2]; float f5=amx_ctof(*MF_GetAmxAddr(amx, params[5])); float f6=amx_ctof(*MF_GetAmxAddr(amx, params[6])); #if defined(_WIN32) return reinterpret_cast<int (__fastcall *)(void *, int, Vector, Vector, float, float)>(__func)(pv, 0, v3, v4, f5, f6); #elif defined(__linux__) || defined(__APPLE__) return reinterpret_cast<int (*)(void *, Vector, Vector, float, float)>(__func)(pv, v3, v4, f5, f6); #endif }
//(mahnsawce) static cell AMX_NATIVE_CALL trace_hull(AMX *amx,cell *params) { int iResult=0; TraceResult tr; Vector vPos; cell *vCell; vCell = MF_GetAmxAddr(amx, params[1]); vPos.x = amx_ctof(vCell[0]); vPos.y = amx_ctof(vCell[1]); vPos.z = amx_ctof(vCell[2]); TRACE_HULL(vPos,vPos, params[4], params[2], params[3] > 0 ? INDEXENT2(params[3]) : 0 , &tr); if (tr.fStartSolid) { iResult += 1; } if (tr.fAllSolid) { iResult += 2; } if (!tr.fInOpen) { iResult += 4; } return iResult; }
cell AMX_NATIVE_CALL Natives::CreateDynamicPolygon(AMX *amx, cell *params) { CHECK_PARAMS(7, "CreateDynamicPolygon"); if (core->getData()->getGlobalMaxItems(STREAMER_TYPE_AREA) == core->getData()->areas.size()) { return 0; } if (static_cast<int>(params[4] >= 2 && static_cast<int>(params[4]) % 2)) { Utility::logError("CreateDynamicPolygon: Number of points must be divisible by two"); return 0; } int areaID = Item::Area::identifier.get(); Item::SharedArea area(new Item::Area); area->amx = amx; area->areaID = areaID; area->type = STREAMER_AREA_TYPE_POLYGON; Utility::convertArrayToPolygon(amx, params[1], params[4], boost::get<Polygon2D>(area->position)); area->height = Eigen::Vector2f(amx_ctof(params[2]), amx_ctof(params[3])); Box2D box = boost::geometry::return_envelope<Box2D>(boost::get<Polygon2D>(area->position)); area->size = static_cast<float>(boost::geometry::comparable_distance(box.min_corner(), box.max_corner())); Utility::addToContainer(area->worlds, static_cast<int>(params[5])); Utility::addToContainer(area->interiors, static_cast<int>(params[6])); Utility::addToContainer(area->players, static_cast<int>(params[7])); core->getGrid()->addArea(area); core->getData()->areas.insert(std::make_pair(areaID, area)); return static_cast<cell>(areaID); }
cell AMX_NATIVE_CALL Natives::SetDynamicObjectRot(AMX *amx, cell *params) { CHECK_PARAMS(4, "SetDynamicObjectRot"); boost::unordered_map<int, Item::SharedObject>::iterator o = core->getData()->objects.find(static_cast<int>(params[1])); if (o != core->getData()->objects.end()) { o->second->rotation = Eigen::Vector3f(amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4])); for (boost::unordered_map<int, Player>::iterator p = core->getData()->players.begin(); p != core->getData()->players.end(); ++p) { boost::unordered_map<int, int>::iterator i = p->second.internalObjects.find(o->first); if (i != p->second.internalObjects.end()) { SetPlayerObjectRot(p->first, i->second, o->second->rotation[0], o->second->rotation[1], o->second->rotation[2]); } } if (o->second->move) { if ((o->second->move->rotation.get<0>().maxCoeff() + 1000.0f) > std::numeric_limits<float>::epsilon()) { o->second->move->rotation.get<1>() = o->second->rotation; o->second->move->rotation.get<2>() = (o->second->move->rotation.get<0>() - o->second->rotation) / static_cast<float>(o->second->move->duration); } } return 1; } return 0; }
cell AMX_NATIVE_CALL funcSetObjectRot ( AMX* a_AmxInterface, cell* a_Params ) { if(bScriptDebug) logprintf ( "[Call]-> funcSetObjectRot()" ); // DEPRECATED FUNCTION logprintf ( "[Script]-> DEPRECATED FUNCTION: SetObjectRot(). Use ElementSetRotation() Instead (Read Open SA-MP Docs)." ); CHECK_PARAMS ( 4 ); uint16_t l_uint16_ObjectIndex = ( uint16_t )a_Params[ 1 ]; CDeprecatedObject* l_Object = NULL; if ( __NetGame->objectPool && ( l_uint16_ObjectIndex < LIMIT_MAX_OBJECT ) && ( l_Object = __NetGame->objectPool->Get ( l_uint16_ObjectIndex ) ) ) { tVector* l_VectorRotation = new tVector(); l_VectorRotation->X = amx_ctof ( a_Params[ 2 ] ); l_VectorRotation->Y = amx_ctof ( a_Params[ 3 ] ); l_VectorRotation->Z = amx_ctof ( a_Params[ 4 ] ); l_Object->SetRotation ( l_VectorRotation ); RakNet::BitStream* l_BitStream = l_Object->ComputeBitStream_SetRotation(); if ( l_BitStream ) { __NetGame->GlobalRPC( RPC_SetObjectRotation, l_BitStream, 0xFFFFu, 2 ); return 1; } } return -1; }
static cell AMX_NATIVE_CALL csdm_trace_hull(AMX *amx,cell *params) { TraceResult tr; Vector vPos; cell *vCell; vCell = MF_GetAmxAddr(amx, params[1]); vPos.x = amx_ctof(vCell[0]); vPos.y = amx_ctof(vCell[1]); vPos.z = amx_ctof(vCell[2]); TRACE_HULL(vPos,vPos, 0, params[2], NULL, &tr); if (tr.fStartSolid) return 1; if (tr.fAllSolid) return 1; if (!tr.fInOpen) return 1; return 0; }
cell AMX_NATIVE_CALL ColAndreasNatives::CA_RayCastLine(AMX *amx, cell *params) { cell* addr[3]; // Adding a small value prevents a potential crash if all values are the same btVector3 Start = btVector3(btScalar(amx_ctof(params[1]) + 0.00001), btScalar(amx_ctof(params[2]) + 0.00001), btScalar(amx_ctof(params[3]) + 0.00001)); btVector3 End = btVector3(btScalar(amx_ctof(params[4])), btScalar(amx_ctof(params[5])), btScalar(amx_ctof(params[6]))); btVector3 Result; uint16_t Model = 0; if (collisionWorld->performRayTest(Start, End, Result, Model)) { //Get our adderesses for the last 3 amx_GetAddr(amx, params[7], &addr[0]); amx_GetAddr(amx, params[8], &addr[1]); amx_GetAddr(amx, params[9], &addr[2]); *addr[0] = amx_ftoc(Result.getX()); *addr[1] = amx_ftoc(Result.getY()); *addr[2] = amx_ftoc(Result.getZ()); return Model; } return 0; }
// CA_RayCastLineNormal(Float:startx, Float:starty, Float:startz, Float:endx, Float:endy, Float:endz, &Float:vector); cell AMX_NATIVE_CALL ColAndreasNatives::CA_RayCastLineNormal(AMX *amx, cell *params) { cell* addr[6]; // Adding a small value prevents a potential crash if all values are the same btVector3 Start = btVector3(btScalar(amx_ctof(params[1]) + 0.00001), btScalar(amx_ctof(params[2]) + 0.00001), btScalar(amx_ctof(params[3]) + 0.00001)); btVector3 End = btVector3(btScalar(amx_ctof(params[4])), btScalar(amx_ctof(params[5])), btScalar(amx_ctof(params[6]))); btVector3 Result; btVector3 Position; uint16_t model; if (collisionWorld->performRayTestNormal(Start, End, Position, Result, model)) { amx_GetAddr(amx, params[7], &addr[0]); amx_GetAddr(amx, params[8], &addr[1]); amx_GetAddr(amx, params[9], &addr[2]); amx_GetAddr(amx, params[10], &addr[3]); amx_GetAddr(amx, params[11], &addr[4]); amx_GetAddr(amx, params[12], &addr[5]); // Return normal *addr[0] = amx_ftoc(Position.getX()); *addr[1] = amx_ftoc(Position.getY()); *addr[2] = amx_ftoc(Position.getZ()); // Return collision vector *addr[3] = amx_ftoc(Result.getX()); *addr[4] = amx_ftoc(Result.getY()); *addr[5] = amx_ftoc(Result.getZ()); return model; } return 0; }
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); }
static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) { int index = params[1]; CHECK_ENTITY(index); int offset = params[2]; CHECK_OFFSET(offset); #if defined(__linux__) offset += params[4]; #elif defined(__APPLE__) // Use Linux offset in older plugins if (params[0] / sizeof(cell) == 4) offset += params[4]; else offset += params[5]; #endif cell *pcvec = MF_GetAmxAddr(amx, params[3]); Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2])); set_pdata<Vector>(TypeConversion.id_to_edict(index), offset, vec); return 1; }
cell AMX_NATIVE_CALL Natives::AttachDynamicObjectToPlayer(AMX *amx, cell *params) { CHECK_PARAMS(8, "AttachDynamicObjectToPlayer"); if (sampgdk::FindNative("SetPlayerGravity") == NULL) { Utility::logError("AttachDynamicObjectToPlayer: YSF plugin must be loaded to attach objects to players"); return 0; } boost::unordered_map<int, Item::SharedObject>::iterator o = core->getData()->objects.find(static_cast<int>(params[1])); if (o != core->getData()->objects.end()) { if (o->second->move) { Utility::logError("AttachDynamicObjectToPlayer: Object is currently moving and must be stopped first"); return 0; } o->second->attach = boost::intrusive_ptr<Item::Object::Attach>(new Item::Object::Attach); o->second->attach->object = INVALID_STREAMER_ID; o->second->attach->vehicle = INVALID_GENERIC_ID; o->second->attach->player = static_cast<int>(params[2]); o->second->attach->offset = Eigen::Vector3f(amx_ctof(params[3]), amx_ctof(params[4]), amx_ctof(params[5])); o->second->attach->rotation = Eigen::Vector3f(amx_ctof(params[6]), amx_ctof(params[7]), amx_ctof(params[8])); for (boost::unordered_map<int, Player>::iterator p = core->getData()->players.begin(); p != core->getData()->players.end(); ++p) { boost::unordered_map<int, int>::iterator i = p->second.internalObjects.find(o->first); if (i != p->second.internalObjects.end()) { AMX_NATIVE native = sampgdk::FindNative("AttachPlayerObjectToPlayer"); if (native != NULL) { sampgdk::InvokeNative(native, "dddffffff", p->first, i->second, o->second->attach->player, o->second->attach->offset[0], o->second->attach->offset[1], o->second->attach->offset[2], o->second->attach->rotation[0], o->second->attach->rotation[1], o->second->attach->rotation[2]); } for (boost::unordered_map<int, Item::Object::Material>::iterator m = o->second->materials.begin(); m != o->second->materials.end(); ++m) { if (m->second.main) { SetPlayerObjectMaterial(p->first, i->second, m->first, m->second.main->modelID, m->second.main->txdFileName.c_str(), m->second.main->textureName.c_str(), m->second.main->materialColor); } else if (m->second.text) { SetPlayerObjectMaterialText(p->first, i->second, m->second.text->materialText.c_str(), m->first, m->second.text->materialSize, m->second.text->fontFace.c_str(), m->second.text->fontSize, m->second.text->bold, m->second.text->fontColor, m->second.text->backColor, m->second.text->textAlignment); } } } } if (static_cast<int>(params[2]) != INVALID_GENERIC_ID) { core->getStreamer()->attachedObjects.insert(o->second); } else { o->second->attach.reset(); core->getStreamer()->attachedObjects.erase(o->second); core->getGrid()->removeObject(o->second, true); } return 1; } return 0; }
static cell _message_begin(AMX *amx, cell *params, bool useFloat) /* 4 param */ { int numparam = *params / sizeof(cell); float vecOrigin[3]; cell *cpOrigin; if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages && !GET_USER_MSG_NAME(PLID, params[2], NULL))) { LogError(amx, AMX_ERR_NATIVE, "Plugin called message_begin with an invalid message id (%d).", params[2]); return 0; } switch (params[1]) { case MSG_BROADCAST: case MSG_ALL: case MSG_SPEC: case MSG_INIT: MESSAGE_BEGIN(params[1], params[2], NULL); break; case MSG_PVS: case MSG_PAS: case MSG_PVS_R: case MSG_PAS_R: if (numparam < 3) { LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed"); return 0; } cpOrigin = get_amxaddr(amx, params[3]); if (!useFloat) { vecOrigin[0] = static_cast<float>(*cpOrigin); vecOrigin[1] = static_cast<float>(*(cpOrigin + 1)); vecOrigin[2] = static_cast<float>(*(cpOrigin + 2)); } else { vecOrigin[0] = amx_ctof(*cpOrigin); vecOrigin[1] = amx_ctof(*(cpOrigin + 1)); vecOrigin[2] = amx_ctof(*(cpOrigin + 2)); } MESSAGE_BEGIN(params[1], params[2], vecOrigin); break; case MSG_ONE_UNRELIABLE: case MSG_ONE: if (numparam < 4) { LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed"); return 0; } MESSAGE_BEGIN(params[1], params[2], NULL, INDEXENT(params[4])); break; } return 1; }
cell AMX_NATIVE_CALL ColAndreasNatives::CA_SetObjectRot(AMX *amx, cell *params) { uint16_t index = static_cast<uint16_t>(params[1]); btQuaternion result; btVector3 rotation = btVector3(amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4])); collisionWorld->EulerToQuat(rotation, result); return collisionWorld->objectManager->setObjectRotation(index, result); }
Vector CellToVector(AMX *amx, cell param) { cell *addr = MF_GetAmxAddr(amx, param); Vector a(amx_ctof(addr[0]), amx_ctof(addr[1]), amx_ctof(addr[2])); return a; }
cell AMX_NATIVE_CALL _SetPlayerPosFindZ(AMX* amx, cell*params) { InteriorChange[params[1]] = 4; g_Invoke->callNative(&PAWN::SetPlayerPosFindZ,params[1],amx_ctof(params[2]),amx_ctof(params[3]),amx_ctof(params[4])); PlayerAir[params[1]].posx = amx_ctof(params[2]); PlayerAir[params[1]].posy = amx_ctof(params[3]); PlayerAir[params[1]].posz = amx_ctof(params[4]); return 1; }
void VectorPointerHandler::convertFromAmxToStructure(AMX* amx, cell param, void* address) { cell* amxVector = MF_GetAmxAddr(amx, param); vec3_t* vector = (vec3_t*)address; vector->x = amx_ctof(amxVector[0]); vector->y = amx_ctof(amxVector[1]); vector->z = amx_ctof(amxVector[2]); }
cell AMX_NATIVE_CALL _AddStaticVehicleEx (AMX* amx, cell* params) { int id = g_Invoke->callNative(&PAWN::AddStaticVehicleEx,params[1],amx_ctof(params[2]),amx_ctof(params[3]),amx_ctof(params[4]),amx_ctof(params[5]),params[6],params[7],params[8]); TOTALCARS ++; Vehicle[id].posx = amx_ctof(params[2]); Vehicle[id].posy = amx_ctof(params[3]); Vehicle[id].posz = amx_ctof(params[4]); Vehicle[id].posa = amx_ctof(params[5]); return id; }
cell AMX_NATIVE_CALL Natives::IsPointInDynamicArea(AMX *amx, cell *params) { CHECK_PARAMS(4, "IsPointInDynamicArea"); boost::unordered_map<int, Item::SharedArea>::iterator a = core->getData()->areas.find(static_cast<int>(params[1])); if (a != core->getData()->areas.end()) { return Utility::isPointInArea(Eigen::Vector3f(amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4])), a->second); } return 0; }
cell AMX_NATIVE_CALL Natives::CreateDynamicObject(AMX *amx, cell *params) { CHECK_PARAMS(13, "CreateDynamicObject"); if (core->getData()->getGlobalMaxItems(STREAMER_TYPE_OBJECT) == core->getData()->objects.size()) { return 0; } int objectID = Item::Object::identifier.get(); Item::SharedObject object(new Item::Object); object->amx = amx; object->objectID = objectID; object->noCameraCollision = false; object->originalStreamDistance = -1.0f; object->modelID = static_cast<int>(params[1]); object->position = Eigen::Vector3f(amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4])); object->rotation = Eigen::Vector3f(amx_ctof(params[5]), amx_ctof(params[6]), amx_ctof(params[7])); Utility::addToContainer(object->worlds, static_cast<int>(params[8])); Utility::addToContainer(object->interiors, static_cast<int>(params[9])); Utility::addToContainer(object->players, static_cast<int>(params[10])); object->streamDistance = amx_ctof(params[11]) < STREAMER_STATIC_DISTANCE_CUTOFF ? amx_ctof(params[11]) : amx_ctof(params[11]) * amx_ctof(params[11]); object->drawDistance = amx_ctof(params[12]); Utility::addToContainer(object->areas, static_cast<int>(params[13])); core->getGrid()->addObject(object); core->getData()->objects.insert(std::make_pair(objectID, object)); return static_cast<cell>(objectID); }
cell AMX_NATIVE_CALL ColAndreasNatives::CA_RayCastLineAngleEx(AMX *amx, cell *params) { cell* addr[12]; // Adding a small value prevents a potential crash if all values are the same btVector3 Start = btVector3(btScalar(amx_ctof(params[1]) + 0.00001), btScalar(amx_ctof(params[2]) + 0.00001), btScalar(amx_ctof(params[3]) + 0.00001)); btVector3 End = btVector3(btScalar(amx_ctof(params[4])), btScalar(amx_ctof(params[5])), btScalar(amx_ctof(params[6]))); btVector3 Result; btVector3 Rotation; btQuaternion ObjectRotation; btVector3 ObjectPosition; btScalar RX; btScalar RY; btScalar RZ; uint16_t Model = 0; if (collisionWorld->performRayTestAngleEx(Start, End, Result, RX, RY, RZ, ObjectRotation, ObjectPosition, Model)) { //Get our adderesses for the last 5 amx_GetAddr(amx, params[7], &addr[0]); amx_GetAddr(amx, params[8], &addr[1]); amx_GetAddr(amx, params[9], &addr[2]); amx_GetAddr(amx, params[10], &addr[3]); amx_GetAddr(amx, params[11], &addr[4]); amx_GetAddr(amx, params[12], &addr[5]); amx_GetAddr(amx, params[13], &addr[6]); amx_GetAddr(amx, params[14], &addr[7]); amx_GetAddr(amx, params[15], &addr[8]); amx_GetAddr(amx, params[16], &addr[9]); amx_GetAddr(amx, params[17], &addr[10]); amx_GetAddr(amx, params[18], &addr[11]); *addr[0] = amx_ftoc(Result.getX()); *addr[1] = amx_ftoc(Result.getY()); *addr[2] = amx_ftoc(Result.getZ()); *addr[3] = amx_ftoc(RX); *addr[4] = amx_ftoc(RY); *addr[5] = amx_ftoc(RZ); *addr[6] = amx_ftoc(ObjectPosition.getX()); *addr[7] = amx_ftoc(ObjectPosition.getY()); *addr[8] = amx_ftoc(ObjectPosition.getZ()); collisionWorld->QuatToEuler(ObjectRotation, Result); *addr[9] = amx_ftoc(Result.getX()); *addr[10] = amx_ftoc(Result.getY()); *addr[11] = amx_ftoc(Result.getZ()); return Model; } return 0; }
// native Float:geoip_distance(Float:lat1, Float:lon1, Float:lat2, Float:lon2, system = SYSTEM_METRIC); static cell AMX_NATIVE_CALL amx_geoip_distance(AMX *amx, cell *params) { float earthRadius = params[5] ? 3958.0 : 6370.997; // miles / km float lat1 = amx_ctof(params[1]) * (M_PI / 180); float lon1 = amx_ctof(params[2]) * (M_PI / 180); float lat2 = amx_ctof(params[3]) * (M_PI / 180); float lon2 = amx_ctof(params[4]) * (M_PI / 180); return amx_ftoc(earthRadius * acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1))); }
static cell AMX_NATIVE_CALL n_floatdiv(AMX *amx,const cell *params) { /* * params[0] = number of bytes * params[1] = float dividend (top) * params[2] = float divisor (bottom) */ REAL fRes = amx_ctof(params[1]) / amx_ctof(params[2]); (void)amx; return amx_ftoc(fRes); }
static cell AMX_NATIVE_CALL n_floatmul(AMX *amx,const cell *params) { /* * params[0] = number of bytes * params[1] = float operand 1 * params[2] = float operand 2 */ REAL fRes = amx_ctof(params[1]) * amx_ctof(params[2]); (void)amx; return amx_ftoc(fRes); }
void* VectorPointerHandler::convertFromAmx(AMX* amx, cell param) { cell* amxVector = MF_GetAmxAddr(amx, param); vec3_t* vector = allocateMemory<vec3_t>(); vector->x = amx_ctof(amxVector[0]); vector->y = amx_ctof(amxVector[1]); vector->z = amx_ctof(amxVector[2]); return (void *)vector; }
static cell AMX_NATIVE_CALL PointContents(AMX *amx, cell *params) { cell *cAddr = MF_GetAmxAddr(amx, params[1]); REAL fX = amx_ctof(cAddr[0]); REAL fY = amx_ctof(cAddr[1]); REAL fZ = amx_ctof(cAddr[2]); Vector vPoint = Vector(fX, fY, fZ); return POINT_CONTENTS(vPoint); }
static cell AMX_NATIVE_CALL amxx_SetBotLookAt(AMX *amx, cell *params) // 1.30 { if (!Amxx_SetBotLookAt || api_version < float(1.30)) return -2; int id = params[1]; //cell *cpVec1 = get_amxaddr(amx, params[2]); cell *cpVec1 = g_fn_GetAmxAddr(amx, params[2]); Vector lookAt = Vector(amx_ctof((float)cpVec1[0]), amx_ctof((float)cpVec1[1]), amx_ctof((float)cpVec1[2])); Amxx_SetBotLookAt(id, lookAt); }
cell AMX_NATIVE_CALL _PutPlayerInVehicle(AMX* amx, cell*params) { InteriorChange[params[1]] = 4; EnterCar[params[1]] = params[2]; g_Invoke->callNative(&PAWN::PutPlayerInVehicle,params[1],params[2],params[3]); float x[3]; g_Invoke->callNative(&PAWN::GetVehiclePos,params[2],&x[0],&x[1],&x[2]); PlayerAir[params[1]].posx = amx_ctof(x[0]); PlayerAir[params[1]].posy = amx_ctof(x[1]); PlayerAir[params[1]].posz = amx_ctof(x[2]); return 1; }
cell AMX_NATIVE_CALL Natives::IsPointInAnyDynamicArea(AMX *amx, cell *params) { CHECK_PARAMS(3, "IsPointInAnyDynamicArea"); for (boost::unordered_map<int, Item::SharedArea>::const_iterator a = core->getData()->areas.begin(); a != core->getData()->areas.end(); ++a) { if (Utility::isPointInArea(Eigen::Vector3f(amx_ctof(params[1]), amx_ctof(params[2]), amx_ctof(params[3])), a->second)) { return 1; } } return 0; }
static cell AMX_NATIVE_CALL n_EmitSound(AMX* amx, const cell *params) { char *ret = NULL; char *charsample = NULL; amx_StrParam(amx, params[3], charsample); // EmitSound(edict, channel, charsample[], Float:volume, Float:attenuation, fFlags, pitch); engineModule *engine = new engineModule; //push 64, push 0, PUSH 3F4CCCCD [0.800000011920929], PUSH 3F800000 [1], PUSH 4210E174 [sample], PUSH 1, PUSH ESI engine->EmitSound(params[1], params[2], charsample, amx_ctof(params[4]), amx_ctof(params[5]), params[6], params[7]); //printf("EmitSound(%i, %i, %s, %f, %f, %i, %i)\n", params[1], params[2], charsample, amx_ctof(params[4]), amx_ctof(params[5]), params[6], params[7]); delete engine; return 0; }