diff --git a/amxmodx/CLang.cpp b/amxmodx/CLang.cpp index 6f166150..97a2dc3e 100755 --- a/amxmodx/CLang.cpp +++ b/amxmodx/CLang.cpp @@ -612,7 +612,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) *tmpPtr++ = *tmpCell++; *tmpPtr = 0; - sprintf(outptr, format, tmpString); + _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, tmpString); ZEROTERM(outbuf); break; } @@ -620,7 +620,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) case 'f': { NEXT_PARAM(); - sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++])); + _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, *(REAL*)get_amxaddr(amx, params[parm++])); ZEROTERM(outbuf); break; } @@ -629,7 +629,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) case 'c': { NEXT_PARAM(); - sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++])); + _snprintf(outptr, sizeof(outbuf)-(outptr-outbuf)-1, format, (int)*get_amxaddr(amx, params[parm++])); ZEROTERM(outbuf); break; } @@ -698,7 +698,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) while (tmpPtr-tmpStringbot && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); + if ( !pPlayer->bot && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, UTIL_VarArgs("%s", cmd) ); } return len; @@ -1141,7 +1141,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */ for(int i = 1; i <= gpGlobals->maxClients; ++i){ CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); if (!pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) - CLIENT_COMMAND(pPlayer->pEdict, cmd ); + CLIENT_COMMAND(pPlayer->pEdict, UTIL_VarArgs("%s", cmd) ); } } else { @@ -1152,7 +1152,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */ } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); if ( !pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) - CLIENT_COMMAND(pPlayer->pEdict, cmd ); + CLIENT_COMMAND(pPlayer->pEdict, UTIL_VarArgs("%s", cmd) ); } return len; } diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index da178383..6575c3d5 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -68,7 +68,7 @@ #include "amxxlog.h" #define AMXXLOG_Log g_log.Log -#define AMX_VERSION "1.01" +#define AMX_VERSION "1.10-RC1" extern AMX_NATIVE_INFO core_Natives[]; extern AMX_NATIVE_INFO time_Natives[]; @@ -116,6 +116,7 @@ void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, char *pM void UTIL_IntToString(int value, char *output); void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name); void UTIL_ShowMenu( edict_t* pEntity, int slots, int time, char *menu, int mlen ); +const char *UTIL_VarArgs(const char *fmt, ...); #define GET_PLAYER_POINTER(e) (&g_players[ENTINDEX(e)]) diff --git a/amxmodx/util.cpp b/amxmodx/util.cpp index d0f4c895..2591da17 100755 --- a/amxmodx/util.cpp +++ b/amxmodx/util.cpp @@ -33,6 +33,22 @@ #include "amxmodx.h" +#ifdef __linux__ +#define _vsnprintf vsnprintf +#endif + +const char *UTIL_VarArgs(const char *fmt, ...) +{ + va_list ap; + static char string[4096]; + + va_start(ap, fmt); + _vsnprintf(string, sizeof(string)-1, fmt, ap); + va_end(ap); + + return string; +} + int UTIL_ReadFlags(const char* c) { int flags = 0; @@ -260,17 +276,6 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1, { if (!cmd) return; // no command - /* - char clCmd[256]; - snprintf(g_fakecmd.args, 255, "%s%s%s%s%s", cmd, - arg1 ? " " : "", arg1 ? arg1 : "", - arg2 ? " " : "", arg2 ? arg2 : ""); - clCmd[255] = 0; - CLIENT_COMMAND(pEdict, clCmd); - return; - */ - if (!cmd) - return; // no command // store command g_fakecmd.argv[0] = cmd; diff --git a/amxmodx/version.rc b/amxmodx/version.rc index c9639e51..da525436 100755 --- a/amxmodx/version.rc +++ b/amxmodx/version.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,0 - PRODUCTVERSION 1,0,1,0 + FILEVERSION 1,1,0,0 + PRODUCTVERSION 1,1,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BEGIN VALUE "Comments", "AMX Mod X" VALUE "FileDescription", "AMX Mod X" - VALUE "FileVersion", "1.01" + VALUE "FileVersion", "1.10-RC1" VALUE "InternalName", "amxmodx" VALUE "LegalCopyright", "Copyright (c) 2004-2005, AMX Mod X Dev Team" VALUE "OriginalFilename", "amxmodx_mm.dll" VALUE "ProductName", "AMX Mod X" - VALUE "ProductVersion", "1.01" + VALUE "ProductVersion", "1.10-RC1" END END BLOCK "VarFileInfo"