CHANGES
This commit is contained in:
parent
bd2ef13798
commit
152ee5e4d5
|
@ -1,5 +1,7 @@
|
|||
#define VERSION "0.79"
|
||||
|
||||
using namespace std;
|
||||
|
||||
plugin_info_t Plugin_info = {
|
||||
|
||||
META_INTERFACE_VERSION, // ifvers
|
||||
|
@ -303,7 +305,6 @@ public:
|
|||
writelong = (long)0;
|
||||
writeangle = 0.0;
|
||||
writecoord = 0.0;
|
||||
writestring = '\0';
|
||||
writeentity = 0;
|
||||
}
|
||||
|
||||
|
@ -363,9 +364,7 @@ public:
|
|||
switch (argtype)
|
||||
{
|
||||
case arg_string:
|
||||
delete[] writestring;
|
||||
writestring = new char[strlen(sz)+1];
|
||||
strcpy(writestring, sz);
|
||||
writestring.append((char *)sz);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +392,7 @@ public:
|
|||
WRITE_COORD(writecoord);
|
||||
break;
|
||||
case arg_string:
|
||||
WRITE_STRING(writestring);
|
||||
WRITE_STRING(writestring.c_str());
|
||||
break;
|
||||
case arg_entity:
|
||||
WRITE_ENTITY(writeentity);
|
||||
|
@ -436,7 +435,6 @@ public:
|
|||
return writecoord;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
@ -445,18 +443,18 @@ public:
|
|||
switch (argtype)
|
||||
{
|
||||
case arg_string:
|
||||
return (strlen(writestring));
|
||||
return (writestring.length());
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *getarg_string(int arg_type)
|
||||
const char *getarg_string(int arg_type)
|
||||
{
|
||||
switch (argtype)
|
||||
{
|
||||
case arg_string:
|
||||
return (strlen(writestring)?writestring:'\0');
|
||||
return writestring.c_str();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -658,7 +656,7 @@ private:
|
|||
int writelong;
|
||||
float writeangle;
|
||||
float writecoord;
|
||||
char *writestring;
|
||||
string writestring;
|
||||
int writeentity;
|
||||
argStack *next;
|
||||
};
|
||||
|
@ -861,7 +859,7 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
char* RetArg_String(int n)
|
||||
const char* RetArg_String(int n)
|
||||
{
|
||||
argStack *p;
|
||||
int i=0;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <modules.h>
|
||||
#include <vector>
|
||||
#include <limits.h>
|
||||
#include <iostream>
|
||||
#include "engine.h"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//(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)
|
||||
//gets a message argument as a string
|
||||
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;
|
||||
}
|
||||
|
||||
//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.
|
||||
// (vexd)
|
||||
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?
|
||||
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
||||
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -771,7 +807,6 @@ static cell AMX_NATIVE_CALL entity_get_float(AMX *amx, cell *params) {
|
|||
|
||||
// Valid entity?
|
||||
if (iTargetEntity < 1 || iTargetEntity > gpGlobals->maxEntities) {
|
||||
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
|
||||
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));
|
||||
|
||||
if(!iReturnEnt || FNullEnt(iReturnEnt)) {
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return iReturnEnt;
|
||||
|
@ -2573,7 +2608,7 @@ void Touch(edict_t *pToucher, edict_t *pTouched) {
|
|||
cell iResult;
|
||||
META_RES result = MRES_IGNORED;
|
||||
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) {
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
} else if (iResult & 1) {
|
||||
|
@ -2585,7 +2620,6 @@ void Touch(edict_t *pToucher, edict_t *pTouched) {
|
|||
}
|
||||
|
||||
// ClientConnect, reinitialize player info here as well.
|
||||
// Also gives small message that its using the model.
|
||||
//(vexd)
|
||||
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));
|
||||
|
@ -2597,8 +2631,6 @@ BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress
|
|||
PlInfo[ENTINDEX(pEntity)].iRenderMode = 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);
|
||||
}
|
||||
|
||||
|
@ -3098,6 +3130,9 @@ AMX_NATIVE_INFO Engine_Natives[] = {
|
|||
{"get_msg_args", get_msg_args},
|
||||
{"get_msg_argtype", get_msg_argtype},
|
||||
|
||||
{"is_valid_ent", is_valid_ent},
|
||||
{"spawn_user", spawn_user},
|
||||
|
||||
{ NULL, NULL }
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user