Пример #1
0
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */
{
	
	int index = params[1] + 1;

	for(RankSystem::iterator a = g_rank.front(); a ;--a){
		if ((*a).getPosition() == index)  {
			cell *cpStats = MF_GetAmxAddr(amx,params[2]);
			cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
			cpStats[0] = (*a).kills;
			cpStats[1] = (*a).deaths;
			cpStats[2] = (*a).hs;
			cpStats[3] = (*a).tks;
			cpStats[4] = (*a).shots;
			cpStats[5] = (*a).hits;
			cpStats[6] = (*a).damage;

			cpStats[7] = (*a).getPosition();

			MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
			if (params[6] > 0)
				MF_SetAmxString(amx, params[6], (*a).getUnique(), params[7]);
			for(int i = 1; i < 8; ++i)
				cpBodyHits[i] = (*a).bodyHits[i];
			return --a ? index : 0;
		}	
	}
	
	return 0;
}
Пример #2
0
cell Call_Int_Vector_Cbase(AMX *amx, cell *params)
{
	SETUP(2);

	Vector v3;
	float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
	v3.x=fl3[0];
	v3.y=fl3[1];
	v3.z=fl3[2];

	int id4=*MF_GetAmxAddr(amx, params[4]);
	CHECK_ENTITY(id4);
	void *p4=IndexToPrivate(id4);

#if defined(_WIN32)
	int ret=reinterpret_cast<int (__fastcall *)(void *, int, Vector, void*)>(__func)(pv, 0, v3, p4);
#elif defined(__linux__) || defined(__APPLE__)
	int ret=reinterpret_cast<int (*)(void *, Vector, void*)>(__func)(pv, v3, p4);
#endif

	fl3[0]=v3.x;
	fl3[1]=v3.y;
	fl3[2]=v3.z;

	return ret;
}
Пример #3
0
cell Call_Int_Cbase_pVector(AMX *amx, cell *params)
{
	SETUP(2);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	CHECK_ENTITY(id3);
	void *pv1=(INDEXENT_NEW(id3)->pvPrivateData);

	Vector v4;
	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

#if defined(_WIN32)
	int ret = reinterpret_cast<int (__fastcall *)(void*, int, void *, Vector *)>(__func)(pv, 0, pv1, &v4);
#elif defined(__linux__) || defined(__APPLE__)
	int ret = reinterpret_cast<int (*)(void *, void *, Vector *)>(__func)(pv, pv1, &v4);
#endif

	fl4[0]=v4.x;
	fl4[1]=v4.y;
	fl4[2]=v4.z;

	return ret;
}
Пример #4
0
cell Call_Void_Cbase_pVector_Float(AMX *amx, cell *params)
{
	SETUP(3);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	CHECK_ENTITY(id3);

	void *i3=IndexToPrivate(id3);

	Vector v4;
	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

	float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void*, int, void *, Vector *, float)>(__func)(pv, 0, i3, &v4, f5);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, void *, Vector *, float)>(__func)(pv, i3, &v4, f5);
#endif

	fl4[0]=v4.x;
	fl4[1]=v4.y;
	fl4[2]=v4.z;

	return 1;
}
Пример #5
0
cell Call_Vector_pVector(AMX *amx, cell *params)
{
	SETUP(2);

	Vector v3;
	float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
	v3.x=fl3[0];
	v3.y=fl3[1];
	v3.z=fl3[2];

#if defined(_WIN32)
	Vector ret;
	reinterpret_cast<void (__fastcall *)(void *, int, Vector*, Vector*)>(__func)(pv, 0, &ret, &v3);
#elif defined(__linux__) || defined(__APPLE__)
	Vector ret=reinterpret_cast<Vector (*)(void *, Vector*)>(__func)(pv, &v3);
#endif
	float *out=(float *)MF_GetAmxAddr(amx, params[4]);
	out[0]=ret.x;
	out[1]=ret.y;
	out[2]=ret.z;

	fl3[0]=v3.x;
	fl3[1]=v3.y;
	fl3[2]=v3.z;

	return 1;
} 
Пример #6
0
cell Call_Void_Float_Vector_Trace_Int(AMX *amx, cell *params)
{
	SETUP(4);

	float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
	Vector v4;
	TraceResult *tr5=reinterpret_cast<TraceResult *>(*MF_GetAmxAddr(amx, params[5]));
	int i6=*MF_GetAmxAddr(amx, params[6]);

	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

	if (tr5==NULL)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");

		return 0;
	}

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void *, int, float, Vector, TraceResult *, int)>(__func)(pv, 0, f3, v4, tr5, i6);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, float, Vector, TraceResult *, int)>(__func)(pv, f3, v4, tr5, i6);
#endif

	return 1;
}
Пример #7
0
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_ctof2(*MF_GetAmxAddr(amx, params[5]));
	float f6=amx_ctof2(*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
}
Пример #8
0
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */
{
	int index = params[1] + 1;
	RankSystem::iterator a;
	a.getEntryByRank(index);
	if (a)
	{
		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
		cpStats[0] = (*a).kills;
		cpStats[1] = (*a).deaths;
		cpStats[2] = (*a).hs;
		cpStats[3] = (*a).tks;
		cpStats[4] = (*a).shots;
		cpStats[5] = (*a).hits;
		cpStats[6] = (*a).damage;

		cpStats[7] = (*a).getPosition();

		MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
		if (params[6] > 0)
		{
			MF_SetAmxString(amx, params[6], (*a).getUnique(), params[7]);
		}
		for (int i = 1; i < 8; ++i)
		{
			cpBodyHits[i] = (*a).bodyHits[i];
		}
		return index;
	}
	return 0;
}
Пример #9
0
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if ( pPlayer->rank ){
		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
		cpStats[0] = pPlayer->rank->kills;
		cpStats[1] = pPlayer->rank->deaths;
		cpStats[2] = pPlayer->rank->hs;
		cpStats[3] = pPlayer->rank->tks;
		cpStats[4] = pPlayer->rank->shots;
		cpStats[5] = pPlayer->rank->hits;
		cpStats[6] = pPlayer->rank->damage;

		cpStats[7] = pPlayer->rank->getPosition();

		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = pPlayer->rank->bodyHits[i];
		return pPlayer->rank->getPosition();
	}
	return 0;

}
Пример #10
0
static cell AMX_NATIVE_CALL fm_return(AMX *amx, cell *params)
{
	int len;
	switch (params[1])
	{
	case FMV_STRING:
		{
			mStringResult = STRING(ALLOC_STRING(MF_GetAmxString(amx, params[2], 0 ,&len)));
			break;
		}
	case FMV_FLOAT:
		{
			mFloatResult = amx_ctof(*(MF_GetAmxAddr(amx,params[2])));
			break;
		}
	case FMV_CELL:
		{
			mCellResult = *(MF_GetAmxAddr(amx,params[2]));
			break;
		}
	default:
		{
		return 0;
		break;
		}
	}

	retType = params[1];

	return 1;
}
Пример #11
0
// GetModelCollisionBox( index, Float:mins[3], Float:maxs[3] );
static cell AMX_NATIVE_CALL GetModelCollisionBox(AMX *amx, cell *params)
{
	int entityIndex = params[1];

	CHECK_ENTITY(entityIndex);

	edict_t *pEdict = INDEXENT2(entityIndex);

	if (!FNullEnt(pEdict))
	{
		studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pEdict));

		if (!pStudiohdr)
		{
			MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
			return 0;
		}

		cell *cmins = MF_GetAmxAddr(amx, params[2]);
		cell *cmaxs = MF_GetAmxAddr(amx, params[3]);

		cmins[0] = amx_ftoc(pStudiohdr->bbmin.x);
		cmins[1] = amx_ftoc(pStudiohdr->bbmin.y);
		cmins[2] = amx_ftoc(pStudiohdr->bbmin.z);

		cmaxs[0] = amx_ftoc(pStudiohdr->bbmax.x);
		cmaxs[1] = amx_ftoc(pStudiohdr->bbmax.y);
		cmaxs[2] = amx_ftoc(pStudiohdr->bbmax.z);

		return 1;
	}

	return 0;
};
Пример #12
0
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	int attacker = params[2];
	CHECK_PLAYERRANGE(attacker);
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if (pPlayer->attackers[attacker].hits){
		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
		CPlayer::PlayerWeapon* stats = &pPlayer->attackers[attacker];
		cpStats[0] = stats->kills;
		cpStats[1] = stats->deaths;
		cpStats[2] = stats->hs;
		cpStats[3] = stats->tks;
		cpStats[4] = stats->shots;
		cpStats[5] = stats->hits;
		cpStats[6] = stats->damage;
		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = stats->bodyHits[i];
		if (params[6] && attacker && stats->name )
			MF_SetAmxString(amx,params[5],stats->name,params[6]);
		return 1;
	}
	return 0;
}
Пример #13
0
static cell AMX_NATIVE_CALL trace_normal(AMX *amx, cell *params)
{
	int iEnt = params[1];

	cell *cStart = MF_GetAmxAddr(amx, params[2]);
	cell *cEnd = MF_GetAmxAddr(amx, params[3]);
	REAL fStartX = amx_ctof(cStart[0]);
	REAL fStartY = amx_ctof(cStart[1]);
	REAL fStartZ = amx_ctof(cStart[2]);
	REAL fEndX = amx_ctof(cEnd[0]);
	REAL fEndY = amx_ctof(cEnd[1]);
	REAL fEndZ = amx_ctof(cEnd[2]);

	cell *vRet = MF_GetAmxAddr(amx, params[4]);

	Vector vStart = Vector(fStartX, fStartY, fStartZ);
	Vector vEnd = Vector(fEndX, fEndY, fEndZ);

	TraceResult tr;
	TRACE_LINE(vStart, vEnd, dont_ignore_monsters, INDEXENT2(iEnt), &tr);

	vRet[0] = amx_ftoc(tr.vecPlaneNormal.x);
	vRet[1] = amx_ftoc(tr.vecPlaneNormal.y);
	vRet[2] = amx_ftoc(tr.vecPlaneNormal.z);

	if (tr.flFraction >= 1.0)
		return 0;

	return 1;
}
Пример #14
0
static cell AMX_NATIVE_CALL SQL_ReadResult(AMX *amx, cell *params)
{
	AmxQueryInfo *qInfo = (AmxQueryInfo *)GetHandle(params[1], Handle_Query);
	if (!qInfo)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid query handle: %d", params[1]);
		return 0;
	}

	IResultSet *rs = qInfo->info.rs;

	if (!rs || rs->IsDone())
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "No result set in this query!");
		return 0;
	}

	IResultRow *row = rs->GetRow();

	unsigned int col = static_cast<unsigned int>(params[2]);
	if (col >= rs->FieldCount())
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column: %d", col);
		return 0;
	}

	cell numparams = params[0] / sizeof(cell);
	switch (numparams)
	{
	case 4:
		{
			const char *str = row->GetString(col);
			if (!str)
				str = "";
			cell *len = MF_GetAmxAddr(amx, params[4]);
			MF_SetAmxString(amx, params[3], str, (int)*len);
			break;
		}
	case 3:
		{
			REAL num = row->GetFloat(col);
			cell *addr = MF_GetAmxAddr(amx, params[3]);
			*addr = amx_ftoc(num);
			break;
		}
	case 2:
		{
			int num = row->GetInt(col);
			return num;
			break;
		}
	default:
		{
			MF_LogError(amx, AMX_ERR_NATIVE, "Bad number of arguments passed.");
			break;
		}
	}

	return 1;
}
Пример #15
0
cell Call_Vector_Float_Cbase_Int(AMX *amx, cell *params)
{
	SETUP(4);

	float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
	int id4=*MF_GetAmxAddr(amx, params[4]);
	int i5=*MF_GetAmxAddr(amx, params[5]);
	
	CHECK_ENTITY(id4);

	void *p4=IndexToPrivate(id4);

#if defined(_WIN32)
	Vector ret;
	reinterpret_cast<void(__fastcall *)(void *, int, Vector*, float, void *, int)>(__func)(pv, 0, &ret, f3, p4, i5);
#elif defined(__linux__) || defined(__APPLE__)
	Vector ret = reinterpret_cast<Vector(*)(void *, float, void *, int)>(__func)(pv, f3, p4, i5);
#endif

	float *out = (float *)MF_GetAmxAddr(amx, params[6]);
	out[0] = ret.x;
	out[1] = ret.y;
	out[2] = ret.z;

	return 1;
}
Пример #16
0
cell Call_Void_Vector_Vector(AMX *amx, cell *params)
{
	SETUP(2);

	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];

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void *, int, Vector, Vector)>(__func)(pv, 0, v3, v4);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, Vector, Vector)>(__func)(pv, v3, v4);
#endif

	return 1;
}
Пример #17
0
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params)
{
	SETUP(5);

	int id3=*MF_GetAmxAddr(amx, params[3]);
	float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
	Vector v5;
	TraceResult *tr6=reinterpret_cast<TraceResult *>(*MF_GetAmxAddr(amx, params[6]));
	int i7=*MF_GetAmxAddr(amx, params[7]);

	float *fl5=(float *)MF_GetAmxAddr(amx, params[5]);
	v5.x=fl5[0];
	v5.y=fl5[1];
	v5.z=fl5[2];

	if (tr6==NULL)
	{
		MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");

		return 0;
	}

	CHECK_ENTITY(id3);

	entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void *, int, entvars_t *, float, Vector, TraceResult *, int)>(__func)(pv, 0, ev3, f4, v5, tr6, i7);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void *, entvars_t *, float, Vector, TraceResult *, int)>(__func)(pv, ev3, f4, v5, tr6, i7);
#endif

	return 1;
}
Пример #18
0
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
{
	int index = params[1];
	CHECK_PLAYERRANGE(index);
	int weapon = params[2];
	if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){
		MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
		return 0;
	}
	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
	if (pPlayer->weapons[weapon].shots){
		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
		CPlayer::PlayerWeapon* stats = &pPlayer->weapons[weapon];
		cpStats[0] = stats->kills;
		cpStats[1] = stats->deaths;
		cpStats[2] = stats->hs;
		cpStats[3] = stats->tks;
		cpStats[4] = stats->shots;
		cpStats[5] = stats->hits;
		cpStats[6] = stats->damage;
		for(int i = 1; i < 8; ++i)
			cpBodyHits[i] = stats->bodyHits[i];
		return 1;
	}
	return 0;
}
Пример #19
0
// ns_fire_ps(Particle:id,Float:origin[3],Float:angles[3],flags=0)
static cell AMX_NATIVE_CALL ns_fire_partsys(AMX *amx, cell *params)
{
	float *origin=(float*)MF_GetAmxAddr(amx,params[2]);
	float *angles=(float*)MF_GetAmxAddr(amx,params[3]);

	ParticleMan.FireSystem(static_cast<int>(params[1]),origin,angles,static_cast<int>(params[4]));

	return 0;
};
Пример #20
0
static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params)
{
	int type = params[1];
	cell *cRet;
/*
	TR_AllSolid,			// (int) if true, plane is not valid
	TR_StartSolid,		// (int) if true, the initial point was in a solid area
	TR_InOpen,		// (int)
	TR_InWater,	// (int)
	TR_Fraction,			// (float) time completed, 1.0 = didn't hit anything
	TR_EndPos,			// (vector) final position
	TR_PlaneDist,		// (float)
	TR_PlaneNormal,		// (vector) surface normal at impact
	TR_Hit,				// (entity) entity the surface is on
	TR_Hitgroup			// (int) 0 == generic, non zero is specific body part
*/
	switch (type)
	{
	case TR_AllSolid:
		return g_tr.fAllSolid;
	case TR_StartSolid:
		return g_tr.fStartSolid;
	case TR_InOpen:
		return g_tr.fInOpen;
	case TR_InWater:
		return g_tr.fInWater;
	case TR_Hitgroup:
		return g_tr.iHitgroup;
	case TR_Hit:
		if (!FNullEnt(g_tr.pHit))
			return ENTINDEX(g_tr.pHit);
		else
			return -1;
	case TR_Fraction:
		cRet = MF_GetAmxAddr(amx,params[2]);
		cRet[0] = amx_ftoc(g_tr.flFraction);
		return 1;
	case TR_EndPos:
		cRet = MF_GetAmxAddr(amx,params[2]);
		cRet[0] = amx_ftoc(g_tr.vecEndPos[0]);
		cRet[1] = amx_ftoc(g_tr.vecEndPos[1]);
		cRet[2] = amx_ftoc(g_tr.vecEndPos[2]);
		return 1;
	case TR_PlaneDist:
		cRet = MF_GetAmxAddr(amx,params[2]);
		cRet[0] = amx_ftoc(g_tr.flPlaneDist);
		return 1;
	case TR_PlaneNormal:
		cRet = MF_GetAmxAddr(amx,params[2]);
		cRet[0] = amx_ftoc(g_tr.vecPlaneNormal[0]);
		cRet[1] = amx_ftoc(g_tr.vecPlaneNormal[1]);
		cRet[2] = amx_ftoc(g_tr.vecPlaneNormal[2]);
		return 1;		
	}
	return 0;
}
Пример #21
0
static cell AMX_NATIVE_CALL get_kvd(AMX *amx, cell *params)
{
	KVD_Wrapper *kvdw;
	KeyValueData *kvd;
	if (params[1] == 0)
		kvdw = &g_kvd_glb;
	else
		kvdw = reinterpret_cast<KVD_Wrapper *>(params[1]);
	kvd = kvdw->kvd;

	switch (params[2])
	{
	case KV_fHandled:
		{
			return kvd->fHandled;
			break;
		}
	case KV_ClassName:
		{
			if (params[0] / sizeof(cell) != 4)
			{
				MF_LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
				return 0;
			}
			cell *ptr = MF_GetAmxAddr(amx, params[4]);
			return MF_SetAmxString(amx, params[3], kvd->szClassName, (int)*ptr);
			break;
		}
	case KV_KeyName:
		{
			if (params[0] / sizeof(cell) != 4)
			{
				MF_LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
				return 0;
			}
			cell *ptr = MF_GetAmxAddr(amx, params[4]);
			return MF_SetAmxString(amx, params[3], kvd->szKeyName, (int)*ptr);
			break;
		}
	case KV_Value:
		{
			if (params[0] / sizeof(cell) != 4)
			{
				MF_LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
				return 0;
			}
			cell *ptr = MF_GetAmxAddr(amx, params[4]);
			return MF_SetAmxString(amx, params[3], kvd->szValue, (int)*ptr);
			break;
		}
	}

	MF_LogError(amx, AMX_ERR_NATIVE, "Invalid KeyValueData member: %d", params[2]);

	return 0;
}
Пример #22
0
static cell AMX_NATIVE_CALL get_uc(AMX *amx, cell *params)
{
    usercmd_t *uc;
    if (params[1] == 0)
        uc = &g_uc_glb;
    else
        uc = reinterpret_cast<usercmd_t *>(params[1]);

    cell *ptr;

    switch(params[2])
    {
    case UC_LerpMsec:
        return uc->lerp_msec;
    case UC_Msec:
        return uc->msec;
    case UC_ViewAngles:
        ptr = MF_GetAmxAddr(amx, params[3]);
        ptr[0] = amx_ftoc(uc->viewangles.x);
        ptr[1] = amx_ftoc(uc->viewangles.y);
        ptr[2] = amx_ftoc(uc->viewangles.z);
        return 1;
    case UC_ForwardMove:
        ptr = MF_GetAmxAddr(amx, params[3]);
        *ptr = amx_ftoc(uc->forwardmove);
        return 1;
    case UC_SideMove:
        ptr = MF_GetAmxAddr(amx, params[3]);
        *ptr = amx_ftoc(uc->sidemove);
        return 1;
    case UC_UpMove:
        ptr = MF_GetAmxAddr(amx, params[3]);
        *ptr = amx_ftoc(uc->upmove);
        return 1;
    case UC_LightLevel:
        return uc->lightlevel;
    case UC_Buttons:
        return uc->buttons;
    case UC_Impulse:
        return uc->impulse;
    case UC_WeaponSelect:
        return uc->weaponselect;
    case UC_ImpactIndex:
        return uc->impact_index;
    case UC_ImpactPosition:
        ptr = MF_GetAmxAddr(amx, params[3]);
        ptr[0] = amx_ftoc(uc->impact_position.x);
        ptr[1] = amx_ftoc(uc->impact_position.y);
        ptr[2] = amx_ftoc(uc->impact_position.z);
        return 1;
    }

    MF_LogError(amx, AMX_ERR_NATIVE, "Invalid UserCmd member: %d", params[2]);

    return 0;
}
Пример #23
0
// GetModelBoundingBox( index, Float:mins[3], Float:maxs[3], sequence = Model_DefaultSize );
static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params)
{
	int entityIndex = params[1];

	CHECK_ENTITY(entityIndex);

	edict_t *pentModel = INDEXENT2(entityIndex);

	if (!FNullEnt(pentModel))
	{
		studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pentModel));

		if (!pStudiohdr)
		{
			MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
			return 0;
		}

		cell *bbmins = MF_GetAmxAddr(amx, params[2]);
		cell *bbmaxs = MF_GetAmxAddr(amx, params[3]);

		int sequence = params[4];

		if (sequence <= Model_DefaultSize)
		{
			bbmins[0] = amx_ftoc(pStudiohdr->min.x);
			bbmins[1] = amx_ftoc(pStudiohdr->min.y);
			bbmins[2] = amx_ftoc(pStudiohdr->min.z);

			bbmaxs[0] = amx_ftoc(pStudiohdr->max.x);
			bbmaxs[1] = amx_ftoc(pStudiohdr->max.y);
			bbmaxs[2] = amx_ftoc(pStudiohdr->max.z);
		}
		else
		{
			if (sequence <= Model_CurrentSequence || sequence >= pStudiohdr->numseq)
				sequence = pentModel->v.sequence;

			mstudioseqdesc_t *pSeqdesc;
			pSeqdesc = (mstudioseqdesc_t*)((byte*)pStudiohdr + pStudiohdr->seqindex);

			bbmins[0] = amx_ftoc(pSeqdesc[sequence].bbmin.x);
			bbmins[1] = amx_ftoc(pSeqdesc[sequence].bbmin.y);
			bbmins[2] = amx_ftoc(pSeqdesc[sequence].bbmin.z);

			bbmaxs[0] = amx_ftoc(pSeqdesc[sequence].bbmax.x);
			bbmaxs[1] = amx_ftoc(pSeqdesc[sequence].bbmax.y);
			bbmaxs[2] = amx_ftoc(pSeqdesc[sequence].bbmax.z);
		}

		return 1;
	}

	return 0;
};
Пример #24
0
cell Call_Int_Int_Int(AMX *amx, cell *params)
{
	SETUP(2);

	int i3=*MF_GetAmxAddr(amx, params[3]);
	int i4=*MF_GetAmxAddr(amx, params[4]);

#if defined(_WIN32)
	return reinterpret_cast<int (__fastcall *)(void*, int, int, int)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
	return reinterpret_cast<int (*)(void *, int, int)>(__func)(pv, i3, i4);
#endif
}
Пример #25
0
cell Call_Int_Float_Float(AMX *amx, cell *params)
{
	SETUP(2);

	float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
	float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));

#if defined(_WIN32)
	return reinterpret_cast<int (__fastcall *)(void*, int, float, float)>(__func)(pv, 0, f3, f4);
#elif defined(__linux__) || defined(__APPLE__)
	return reinterpret_cast<int (*)(void *, float, float)>(__func)(pv, f3, f4);
#endif
}
Пример #26
0
cell Call_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, cell *params)
{
	SETUP(5);

	Vector v3;
	Vector v4;

	float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
	float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);

	v3.x=fl3[0];
	v3.y=fl3[1];
	v3.z=fl3[2];

	v4.x=fl4[0];
	v4.y=fl4[1];
	v4.z=fl4[2];

	float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));

	int id6=*MF_GetAmxAddr(amx, params[6]);
	CHECK_ENTITY(id6);
	void *p6=IndexToPrivate(id6);

	Vector v7;
	float *fl7=(float *)MF_GetAmxAddr(amx, params[7]);

	v7.x=fl7[0];
	v7.y=fl7[1];
	v7.z=fl7[2];

#if defined(_WIN32)
	int ret=reinterpret_cast<int (__fastcall *)(void *, int, Vector*, Vector*, float, void*, Vector*)>(__func)(pv, 0, &v3, &v4, f5, p6, &v7);
#elif defined(__linux__) || defined(__APPLE__)
	int ret=reinterpret_cast<int (*)(void *, Vector*, Vector*, float, void*, Vector*)>(__func)(pv, &v3, &v4, f5, p6, &v7);
#endif

	fl3[0]=v3.x;
	fl3[1]=v3.y;
	fl3[2]=v3.z;

	fl4[0]=v4.x;
	fl4[1]=v4.y;
	fl4[2]=v4.z;

	fl7[0]=v7.x;
	fl7[1]=v7.y;
	fl7[2]=v7.z;

	return ret;
}
Пример #27
0
cell Call_Int_Int_Str_Int(AMX *amx, cell *params)
{
	SETUP(3);

	int i3=*MF_GetAmxAddr(amx, params[3]);
	char *sz4=MF_GetAmxString(amx, params[4], 0, NULL);
	int i5=*MF_GetAmxAddr(amx, params[5]);

#if defined(_WIN32)
	return reinterpret_cast<int (__fastcall *)(void*, int, int, const char *, int)>(__func)(pv, 0, i3, sz4, i5);
#elif defined(__linux__) || defined(__APPLE__)
	return reinterpret_cast<int (*)(void *, int, const char *, int)>(__func)(pv, i3, sz4, i5);
#endif
}
Пример #28
0
cell Call_Int_Int_Int_Float_Int(AMX* amx, cell* params)
{
	SETUP(4);

	int i3=*MF_GetAmxAddr(amx, params[3]);
	int i4=*MF_GetAmxAddr(amx, params[4]);
	float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));
	int i6=*MF_GetAmxAddr(amx, params[6]);

#if defined(_WIN32)
	return reinterpret_cast<int (__fastcall *)(void*, int, int, int, float, int)>(__func)(pv, 0, i3, i4, f5, i6);
#elif defined(__linux__) || defined(__APPLE__)
	return reinterpret_cast<int (*)(void *, int, int, float, int)>(__func)(pv, i3, i4, f5, i6);
#endif
}
Пример #29
0
cell Call_Void_Float_Int(AMX* amx, cell* params)
{
	SETUP(2);

	float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
	int i4 = *MF_GetAmxAddr(amx, params[4]);

#if defined(_WIN32)
	reinterpret_cast<void (__fastcall *)(void*, int, float, char)>(__func)(pv, 0, f3, i4);
#elif defined(__linux__) || defined(__APPLE__)
	reinterpret_cast<void (*)(void*, float, char)>(__func)(pv, f3, i4);
#endif

	return 1;
}
Пример #30
0
cell Call_Float_Int(AMX *amx, cell *params)
{
	SETUP(2);

	int i3=*MF_GetAmxAddr(amx, params[3]);
	
#if defined(_WIN32)
	float ret=reinterpret_cast<float (__fastcall *)(void *, int, int)>(__func)(pv, 0, i3);
#elif defined(__linux__) || defined(__APPLE__)
	float ret=reinterpret_cast<float (*)(void *, int)>(__func)(pv, i3);
#endif
	*MF_GetAmxAddr(amx, params[4])=amx_ftoc2(ret);

	return 1;	
}