本文整理汇总了C++中MF_GetAmxAddr函数的典型用法代码示例。如果您正苦于以下问题:C++ MF_GetAmxAddr函数的具体用法?C++ MF_GetAmxAddr怎么用?C++ MF_GetAmxAddr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MF_GetAmxAddr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_stats
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: Call_Int_Vector_Cbase
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: Call_Int_Cbase_pVector
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: Call_Void_Cbase_pVector_Float
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: Call_Vector_pVector
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: Call_Void_Float_Vector_Trace_Int
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: Call_Int_Vector_Vector_Float_Float
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: get_stats
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: get_user_stats
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: fm_return
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: GetModelCollisionBox
// 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: get_user_astats
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: trace_normal
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: SQL_ReadResult
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: Call_Vector_Float_Cbase_Int
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;
}