CHANGES
This commit is contained in:
parent
bd2ef13798
commit
152ee5e4d5
|
@ -1,5 +1,7 @@
|
||||||
#define VERSION "0.79"
|
#define VERSION "0.79"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
plugin_info_t Plugin_info = {
|
plugin_info_t Plugin_info = {
|
||||||
|
|
||||||
META_INTERFACE_VERSION, // ifvers
|
META_INTERFACE_VERSION, // ifvers
|
||||||
|
@ -303,7 +305,6 @@ public:
|
||||||
writelong = (long)0;
|
writelong = (long)0;
|
||||||
writeangle = 0.0;
|
writeangle = 0.0;
|
||||||
writecoord = 0.0;
|
writecoord = 0.0;
|
||||||
writestring = '\0';
|
|
||||||
writeentity = 0;
|
writeentity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,9 +364,7 @@ public:
|
||||||
switch (argtype)
|
switch (argtype)
|
||||||
{
|
{
|
||||||
case arg_string:
|
case arg_string:
|
||||||
delete[] writestring;
|
writestring.append((char *)sz);
|
||||||
writestring = new char[strlen(sz)+1];
|
|
||||||
strcpy(writestring, sz);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,7 +392,7 @@ public:
|
||||||
WRITE_COORD(writecoord);
|
WRITE_COORD(writecoord);
|
||||||
break;
|
break;
|
||||||
case arg_string:
|
case arg_string:
|
||||||
WRITE_STRING(writestring);
|
WRITE_STRING(writestring.c_str());
|
||||||
break;
|
break;
|
||||||
case arg_entity:
|
case arg_entity:
|
||||||
WRITE_ENTITY(writeentity);
|
WRITE_ENTITY(writeentity);
|
||||||
|
@ -436,7 +435,6 @@ public:
|
||||||
return writecoord;
|
return writecoord;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,18 +443,18 @@ public:
|
||||||
switch (argtype)
|
switch (argtype)
|
||||||
{
|
{
|
||||||
case arg_string:
|
case arg_string:
|
||||||
return (strlen(writestring));
|
return (writestring.length());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getarg_string(int arg_type)
|
const char *getarg_string(int arg_type)
|
||||||
{
|
{
|
||||||
switch (argtype)
|
switch (argtype)
|
||||||
{
|
{
|
||||||
case arg_string:
|
case arg_string:
|
||||||
return (strlen(writestring)?writestring:'\0');
|
return writestring.c_str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +656,7 @@ private:
|
||||||
int writelong;
|
int writelong;
|
||||||
float writeangle;
|
float writeangle;
|
||||||
float writecoord;
|
float writecoord;
|
||||||
char *writestring;
|
string writestring;
|
||||||
int writeentity;
|
int writeentity;
|
||||||
argStack *next;
|
argStack *next;
|
||||||
};
|
};
|
||||||
|
@ -861,7 +859,7 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* RetArg_String(int n)
|
const char* RetArg_String(int n)
|
||||||
{
|
{
|
||||||
argStack *p;
|
argStack *p;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <modules.h>
|
#include <modules.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <iostream>
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
extern "C" void destroy(MessageInfo* p) {
|
extern "C" void destroy(MessageInfo* p) {
|
||||||
|
@ -215,6 +216,24 @@ static cell AMX_NATIVE_CALL get_msg_arg_float(AMX *amx, cell *params)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//(JGHG(
|
||||||
|
static cell AMX_NATIVE_CALL spawn_user(AMX *amx, cell *params) // spawn(id) = 1 param
|
||||||
|
{
|
||||||
|
// Spawns an entity, this can be a user/player -> spawns at spawnpoints, or created entities seems to need this as a final "kick" into the game? :-)
|
||||||
|
// params[1] = entity to spawn
|
||||||
|
|
||||||
|
if (params[1] < 1 || params[1] > gpGlobals->maxEntities)
|
||||||
|
{
|
||||||
|
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
edict_t *pEnt = INDEXENT(params[1]);
|
||||||
|
|
||||||
|
MDLL_Spawn(pEnt);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
//(BAILOPAN)
|
//(BAILOPAN)
|
||||||
//gets a message argument as a string
|
//gets a message argument as a string
|
||||||
static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
|
||||||
|
@ -485,6 +504,24 @@ static cell AMX_NATIVE_CALL get_offset_float(AMX *amx, cell *params)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//is an entity valid?
|
||||||
|
//(BAILOPAN)
|
||||||
|
static cell AMX_NATIVE_CALL is_valid_ent(AMX *amx, cell *params) {
|
||||||
|
int iEnt = params[1];
|
||||||
|
|
||||||
|
if (iEnt < 1 || iEnt > gpGlobals->maxEntities) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t *pEntity = INDEXENT(iEnt);
|
||||||
|
|
||||||
|
if (FNullEnt(pEntity)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Get an integer from an entities entvars.
|
// Get an integer from an entities entvars.
|
||||||
// (vexd)
|
// (vexd)
|
||||||
static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params) {
|
static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params) {
|
||||||
|
@ -494,7 +531,6 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params) {
|
||||||
|
|
||||||
// Is it a valid entity?
|
// Is it a valid entity?
|
||||||
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
||||||
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,7 +807,6 @@ static cell AMX_NATIVE_CALL entity_get_float(AMX *amx, cell *params) {
|
||||||
|
|
||||||
// Valid entity?
|
// Valid entity?
|
||||||
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
||||||
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,7 +1791,7 @@ static cell AMX_NATIVE_CALL find_entity(AMX *amx, cell *params) {
|
||||||
int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStartEnt, "classname", szValue));
|
int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStartEnt, "classname", szValue));
|
||||||
|
|
||||||
if(!iReturnEnt || FNullEnt(iReturnEnt)) {
|
if(!iReturnEnt || FNullEnt(iReturnEnt)) {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return iReturnEnt;
|
return iReturnEnt;
|
||||||
|
@ -2573,7 +2608,7 @@ void Touch(edict_t *pToucher, edict_t *pTouched) {
|
||||||
cell iResult;
|
cell iResult;
|
||||||
META_RES result = MRES_IGNORED;
|
META_RES result = MRES_IGNORED;
|
||||||
for (AmxCallList::AmxCall* i = pfnTouch.head; i; i = i->next) {
|
for (AmxCallList::AmxCall* i = pfnTouch.head; i; i = i->next) {
|
||||||
AMX_EXEC(i->amx, &iResult, i->iFunctionIdx, 2, pToucher, pTouched);
|
AMX_EXEC(i->amx, &iResult, i->iFunctionIdx, 2, ENTINDEX(pToucher), ENTINDEX(pTouched));
|
||||||
if (iResult & 2) {
|
if (iResult & 2) {
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if (iResult & 1) {
|
} else if (iResult & 1) {
|
||||||
|
@ -2585,7 +2620,6 @@ void Touch(edict_t *pToucher, edict_t *pTouched) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientConnect, reinitialize player info here as well.
|
// ClientConnect, reinitialize player info here as well.
|
||||||
// Also gives small message that its using the model.
|
|
||||||
//(vexd)
|
//(vexd)
|
||||||
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) {
|
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) {
|
||||||
memset(PlInfo[ENTINDEX(pEntity)].szModel, 0x0, sizeof(PlInfo[ENTINDEX(pEntity)].szModel));
|
memset(PlInfo[ENTINDEX(pEntity)].szModel, 0x0, sizeof(PlInfo[ENTINDEX(pEntity)].szModel));
|
||||||
|
@ -2597,8 +2631,6 @@ BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress
|
||||||
PlInfo[ENTINDEX(pEntity)].iRenderMode = 0;
|
PlInfo[ENTINDEX(pEntity)].iRenderMode = 0;
|
||||||
PlInfo[ENTINDEX(pEntity)].fRenderAmt = 0;
|
PlInfo[ENTINDEX(pEntity)].fRenderAmt = 0;
|
||||||
|
|
||||||
//CLIENT_PRINTF(pEntity, print_console, "*** This server is using Vexd's Utility Module.\n");
|
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3098,6 +3130,9 @@ AMX_NATIVE_INFO Engine_Natives[] = {
|
||||||
{"get_msg_args", get_msg_args},
|
{"get_msg_args", get_msg_args},
|
||||||
{"get_msg_argtype", get_msg_argtype},
|
{"get_msg_argtype", get_msg_argtype},
|
||||||
|
|
||||||
|
{"is_valid_ent", is_valid_ent},
|
||||||
|
{"spawn_user", spawn_user},
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user