reverted project file for now
authorDavid Anderson <dvander@alliedmods.net>
Sat Feb 17 17:25:50 2007 +0000 (2007-02-17)
changeset 51852810a1a9620
parent 517 da53a0fa5721
child 519 1a319bb1ff48
reverted project file for now
moved printing natives
core/msvc8/sourcemod_mm.vcproj
core/smn_console.cpp
core/smn_player.cpp
     1.1 --- a/core/msvc8/sourcemod_mm.vcproj	Sat Feb 17 09:12:21 2007 +0000
     1.2 +++ b/core/msvc8/sourcemod_mm.vcproj	Sat Feb 17 17:25:50 2007 +0000
     1.3 @@ -200,10 +200,6 @@
     1.4  				>
     1.5  			</File>
     1.6  			<File
     1.7 -				RelativePath="..\CGameEventManager.cpp"
     1.8 -				>
     1.9 -			</File>
    1.10 -			<File
    1.11  				RelativePath="..\CLogger.cpp"
    1.12  				>
    1.13  			</File>
    1.14 @@ -662,10 +658,6 @@
    1.15  				>
    1.16  			</File>
    1.17  			<File
    1.18 -				RelativePath="..\smn_events.cpp"
    1.19 -				>
    1.20 -			</File>
    1.21 -			<File
    1.22  				RelativePath="..\smn_filesystem.cpp"
    1.23  				>
    1.24  			</File>
     2.1 --- a/core/smn_console.cpp	Sat Feb 17 09:12:21 2007 +0000
     2.2 +++ b/core/smn_console.cpp	Sat Feb 17 17:25:50 2007 +0000
     2.3 @@ -17,6 +17,8 @@
     2.4  #include "CConVarManager.h"
     2.5  #include "CConCmdManager.h"
     2.6  #include "PluginSys.h"
     2.7 +#include "sm_stringutil.h"
     2.8 +#include "CPlayerManager.h"
     2.9  
    2.10  static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params)
    2.11  {
    2.12 @@ -414,7 +416,53 @@
    2.13  	return 1;
    2.14  }
    2.15  
    2.16 -REGISTER_NATIVES(convarNatives)
    2.17 +static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
    2.18 +{
    2.19 +	char buffer[1024];
    2.20 +	char *fmt;
    2.21 +	int arg = 2;
    2.22 +
    2.23 +	pCtx->LocalToString(params[1], &fmt);
    2.24 +	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
    2.25 +
    2.26 +	buffer[res++] = '\n';
    2.27 +	buffer[res] = '\0';
    2.28 +
    2.29 +	META_CONPRINT(buffer);
    2.30 +
    2.31 +	return 1;
    2.32 +}
    2.33 +
    2.34 +static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
    2.35 +{
    2.36 +	int index = params[1];
    2.37 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    2.38 +	{
    2.39 +		return pCtx->ThrowNativeError("Invalid client index %d", index);
    2.40 +	}
    2.41 +
    2.42 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    2.43 +	if (!pPlayer->IsInGame())
    2.44 +	{
    2.45 +		return pCtx->ThrowNativeError("Client %d is not in game", index);
    2.46 +	}
    2.47 +
    2.48 +	char buffer[1024];
    2.49 +	char *fmt;
    2.50 +	int arg = 3;
    2.51 +
    2.52 +	pCtx->LocalToString(params[2], &fmt);
    2.53 +	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
    2.54 +
    2.55 +	buffer[res++] = '\n';
    2.56 +	buffer[res] = '\0';
    2.57 +
    2.58 +	engine->ClientPrintf(pPlayer->GetEdict(), buffer);
    2.59 +
    2.60 +	return 1;
    2.61 +}
    2.62 +
    2.63 +REGISTER_NATIVES(consoleNatives)
    2.64  {
    2.65  	{"CreateConVar",		sm_CreateConVar},
    2.66  	{"FindConVar",			sm_FindConVar},
    2.67 @@ -439,5 +487,7 @@
    2.68  	{"GetCmdArgString",		sm_GetCmdArgString},
    2.69  	{"GetCmdArgs",			sm_GetCmdArgs},
    2.70  	{"GetCmdArg",			sm_GetCmdArg},
    2.71 +	{"PrintToServer",		sm_PrintToServer},
    2.72 +	{"PrintToConsole",		sm_PrintToConsole},
    2.73  	{NULL,					NULL}
    2.74  };
     3.1 --- a/core/smn_player.cpp	Sat Feb 17 09:12:21 2007 +0000
     3.2 +++ b/core/smn_player.cpp	Sat Feb 17 17:25:50 2007 +0000
     3.3 @@ -159,23 +159,6 @@
     3.4  	return (pPlayer->IsFakeClient()) ? 1 : 0;
     3.5  }
     3.6  
     3.7 -static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
     3.8 -{
     3.9 -	char buffer[1024];
    3.10 -	char *fmt;
    3.11 -	int arg = 2;
    3.12 -
    3.13 -	pCtx->LocalToString(params[1], &fmt);
    3.14 -	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
    3.15 -
    3.16 -	buffer[res++] = '\n';
    3.17 -	buffer[res] = '\0';
    3.18 -
    3.19 -	META_CONPRINT(buffer);
    3.20 -
    3.21 -	return 1;
    3.22 -}
    3.23 -
    3.24  static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
    3.25  {
    3.26  	int client = params[1];
    3.27 @@ -202,35 +185,6 @@
    3.28  	return 1;
    3.29  }
    3.30  
    3.31 -static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
    3.32 -{
    3.33 -	int index = params[1];
    3.34 -	if ((index < 1) || (index > g_Players.GetMaxClients()))
    3.35 -	{
    3.36 -		return pCtx->ThrowNativeError("Invalid client index %d", index);
    3.37 -	}
    3.38 -
    3.39 -	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    3.40 -	if (!pPlayer->IsInGame())
    3.41 -	{
    3.42 -		return pCtx->ThrowNativeError("Client %d is not in game", index);
    3.43 -	}
    3.44 -
    3.45 -	char buffer[1024];
    3.46 -	char *fmt;
    3.47 -	int arg = 3;
    3.48 -
    3.49 -	pCtx->LocalToString(params[2], &fmt);
    3.50 -	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
    3.51 -
    3.52 -	buffer[res++] = '\n';
    3.53 -	buffer[res] = '\0';
    3.54 -
    3.55 -	engine->ClientPrintf(pPlayer->GetEdict(), buffer);
    3.56 -
    3.57 -	return 1;
    3.58 -}
    3.59 -
    3.60  static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
    3.61  {
    3.62  	int client = params[1];
    3.63 @@ -402,8 +356,6 @@
    3.64  	{"IsPlayerInGame",			sm_IsPlayerIngame},
    3.65  	{"IsClientAuthorized",		sm_IsPlayerAuthorized},
    3.66  	{"IsFakeClient",			sm_IsPlayerFakeClient},
    3.67 -	{"PrintToServer",			sm_PrintToServer},
    3.68 -	{"PrintToConsole",			sm_PrintToConsole},
    3.69  	{"GetClientInfo",			sm_GetClientInfo},
    3.70  	{"SetUserAdmin",			SetUserAdmin},
    3.71  	{"GetUserAdmin",			GetUserAdmin},