|
|
|
@@ -163,7 +163,9 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
int bit_count;
|
|
|
|
|
bool is_unsigned;
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
@@ -185,8 +187,6 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
bit_count = params[2] * 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
if (bit_count >= 17)
|
|
|
|
|
{
|
|
|
|
|
return *(int32_t *)((intptr_t)pGameRules + offset);
|
|
|
|
@@ -232,11 +232,13 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
if (params[5] == 0)
|
|
|
|
|
sendChange = false;
|
|
|
|
|
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pProxy = NULL;
|
|
|
|
|
if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
|
|
|
|
|
return pContext->ThrowNativeError("Couldn't find gamerules proxy entity");
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
@@ -250,8 +252,6 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
if (bit_count < 1)
|
|
|
|
|
{
|
|
|
|
|
bit_count = params[3] * 8;
|
|
|
|
@@ -304,15 +304,15 @@ static cell_t GameRules_GetPropFloat(IPluginContext *pContext, const cell_t *par
|
|
|
|
|
int offset;
|
|
|
|
|
int bit_count;
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Float, "float");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
float val = *(float *)((intptr_t)pGameRules + offset);
|
|
|
|
|
|
|
|
|
|
return sp_ftoc(val);
|
|
|
|
@@ -329,18 +329,19 @@ static cell_t GameRules_SetPropFloat(IPluginContext *pContext, const cell_t *par
|
|
|
|
|
if (params[4] == 0)
|
|
|
|
|
sendChange = false;
|
|
|
|
|
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pProxy = NULL;
|
|
|
|
|
if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
|
|
|
|
|
return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Float, "float");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
float newVal = sp_ctof(params[2]);
|
|
|
|
|
|
|
|
|
|
*(float *)((intptr_t)pGameRules + offset) = newVal;
|
|
|
|
@@ -361,15 +362,15 @@ static cell_t GameRules_GetPropEnt(IPluginContext *pContext, const cell_t *param
|
|
|
|
|
int offset;
|
|
|
|
|
int bit_count;
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Int, "Integer");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
CBaseHandle &hndl = *(CBaseHandle *)((intptr_t)pGameRules + offset);
|
|
|
|
|
CBaseEntity *pEntity = gamehelpers->ReferenceToEntity(hndl.GetEntryIndex());
|
|
|
|
|
|
|
|
|
@@ -392,19 +393,19 @@ static cell_t GameRules_SetPropEnt(IPluginContext *pContext, const cell_t *param
|
|
|
|
|
if (params[4] == 0)
|
|
|
|
|
sendChange = false;
|
|
|
|
|
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pProxy = NULL;
|
|
|
|
|
if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
|
|
|
|
|
return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Int, "integer");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
CBaseHandle &hndl = *(CBaseHandle *)((intptr_t)pGameRules + offset);
|
|
|
|
|
CBaseEntity *pOther;
|
|
|
|
|
|
|
|
|
@@ -451,15 +452,15 @@ static cell_t GameRules_GetPropVector(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
int offset;
|
|
|
|
|
int bit_count;
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Vector, "vector");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
Vector *v = (Vector *)((intptr_t)pGameRules + offset);
|
|
|
|
|
|
|
|
|
|
cell_t *vec;
|
|
|
|
@@ -483,19 +484,19 @@ static cell_t GameRules_SetPropVector(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
if (params[4] == 0)
|
|
|
|
|
sendChange = false;
|
|
|
|
|
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pProxy = NULL;
|
|
|
|
|
if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
|
|
|
|
|
return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
|
|
|
|
|
|
FIND_PROP_SEND(DPT_Vector, "vector");
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
Vector *v = (Vector *)((intptr_t)pGameRules + offset);
|
|
|
|
|
|
|
|
|
|
cell_t *vec;
|
|
|
|
@@ -523,7 +524,9 @@ static cell_t GameRules_GetPropString(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
char *prop;
|
|
|
|
|
int offset;
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
@@ -544,8 +547,6 @@ static cell_t GameRules_GetPropString(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
DPT_String);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
|
|
|
|
|
size_t len;
|
|
|
|
|
const char *src;
|
|
|
|
|
|
|
|
|
@@ -585,11 +586,13 @@ static cell_t GameRules_SetPropString(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
if (params[3] == 0)
|
|
|
|
|
sendChange = false;
|
|
|
|
|
|
|
|
|
|
void *pGameRules = GameRules();
|
|
|
|
|
|
|
|
|
|
CBaseEntity *pProxy = NULL;
|
|
|
|
|
if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
|
|
|
|
|
return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
|
|
|
|
|
|
|
|
|
|
if (!g_pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
|
|
|
|
|
return pContext->ThrowNativeError("Gamerules lookup failed.");
|
|
|
|
|
|
|
|
|
|
pContext->LocalToString(params[1], &prop);
|
|
|
|
@@ -610,7 +613,6 @@ static cell_t GameRules_SetPropString(IPluginContext *pContext, const cell_t *pa
|
|
|
|
|
DPT_String);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *pGameRules = *g_pGameRules;
|
|
|
|
|
maxlen = DT_MAX_STRING_BUFFERSIZE;
|
|
|
|
|
|
|
|
|
|
char *src;
|
|
|
|
|