Fixing accidental commit

This commit is contained in:
David Anderson 2004-06-24 07:09:17 +00:00
parent 37d144abe5
commit 4b3d2d3133

View File

@ -33,9 +33,51 @@
#include <time.h> #include <time.h>
#include "amxmodx.h" #include "amxmodx.h"
int emit_sound(int iEdict, int channel, const char *szSample, REAL vol, REAL att, int flags, int pitch) static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
{ {
if (iEdict == 0) { int len;
char* sName = get_amxstring(amx,params[1],0,len);
cell ptr;
for ( CPluginMngr::iterator a = g_plugins.begin(); a ; ++a )
{
if ( (*a).isValid() && amx_FindPubVar( (*a).getAMX() , sName , &ptr ) == AMX_ERR_NONE )
return g_xvars.put( (*a).getAMX() , get_amxaddr( (*a).getAMX() , ptr ) );
}
return -1;
}
static cell AMX_NATIVE_CALL get_xvar_num(AMX *amx, cell *params)
{
return g_xvars.getValue(params[1]);
}
static cell AMX_NATIVE_CALL set_xvar_num(AMX *amx, cell *params)
{
if ( g_xvars.setValue( params[1] , params[2] ) ){
amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0;
}
return 1;
}
static cell AMX_NATIVE_CALL xvar_exists(AMX *amx, cell *params)
{
return (get_xvar_id( amx , params ) != -1) ? 1 : 0;
}
static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
{
int len;
char* szSample = get_amxstring(amx,params[3],0,len);
float vol = *(REAL *)((void *)&params[4]);
float att = *(REAL *)((void *)&params[5]);
int channel = params[2];
int pitch = params[7];
int flags = params[6];
if (params[1] == 0) {
for(int i = 1; i <= gpGlobals->maxClients ; ++i){ for(int i = 1; i <= gpGlobals->maxClients ; ++i){
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame) if (pPlayer->ingame)
@ -44,7 +86,7 @@ int emit_sound(int iEdict, int channel, const char *szSample, REAL vol, REAL att
} }
else else
{ {
edict_t* pEdict = INDEXENT(iEdict); edict_t* pEdict = INDEXENT(params[1]);
if (!FNullEnt(pEdict)) if (!FNullEnt(pEdict))
EMIT_SOUND_DYN2(pEdict,channel , szSample, vol, att, flags, pitch); EMIT_SOUND_DYN2(pEdict,channel , szSample, vol, att, flags, pitch);
} }
@ -52,9 +94,10 @@ int emit_sound(int iEdict, int channel, const char *szSample, REAL vol, REAL att
return 1; return 1;
} }
int server_print(char *message) /* 1 param */ static cell AMX_NATIVE_CALL server_print(AMX *amx, cell *params) /* 1 param */
{ {
int len = strlen(message); int len;
char* message = format_amxstring(amx,params,1,len);
if ( len > 254 ) len = 254; if ( len > 254 ) len = 254;
message[len++]='\n'; message[len++]='\n';
message[len]=0; message[len]=0;
@ -62,12 +105,13 @@ int server_print(char *message) /* 1 param */
return len; return len;
} }
int engclient_print(int iPlayer, int iPrintType, const char *message) /* 3 param */ static cell AMX_NATIVE_CALL engclient_print(AMX *amx, cell *params) /* 3 param */
{ {
int len = strlen(message); int len;
char* message = format_amxstring(amx,params,3,len);
message[len++]='\n'; message[len++]='\n';
message[len]=0; message[len]=0;
if (iPlayer == 0) { if (params[1] == 0) {
for(int i = 1; i <= gpGlobals->maxClients ; ++i){ for(int i = 1; i <= gpGlobals->maxClients ; ++i){
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame) if (pPlayer->ingame)
@ -2137,20 +2181,10 @@ static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
return -1; // not found return -1; // not found
// set name, author, version // set name, author, version
if ((*moduleIter).isAmxx())
{
const amxx_module_info_s *info = (*moduleIter).getInfoNew();
set_amxstring(amx, params[2], info->name, params[3]);
set_amxstring(amx, params[4], info->author, params[5]);
set_amxstring(amx, params[6], info->version, params[7]);
}
else
{
module_info_s *info = (*moduleIter).getInfo(); module_info_s *info = (*moduleIter).getInfo();
set_amxstring(amx, params[2], info->name, params[3]); set_amxstring(amx, params[2], info->name, params[3]);
set_amxstring(amx, params[4], info->author, params[5]); set_amxstring(amx, params[4], info->author, params[5]);
set_amxstring(amx, params[6], info->version, params[7]); set_amxstring(amx, params[6], info->version, params[7]);
}
// compatibility problem possible // compatibility problem possible
int numParams = params[0] / sizeof(cell); int numParams = params[0] / sizeof(cell);