reverted project file for now

moved printing natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40524
This commit is contained in:
David Anderson 2007-02-17 17:25:50 +00:00
parent 43051a0571
commit 03e70ebe16
3 changed files with 51 additions and 57 deletions

View File

@ -199,10 +199,6 @@
RelativePath="..\CDbgReporter.cpp"
>
</File>
<File
RelativePath="..\CGameEventManager.cpp"
>
</File>
<File
RelativePath="..\CLogger.cpp"
>
@ -661,10 +657,6 @@
RelativePath="..\smn_datapacks.cpp"
>
</File>
<File
RelativePath="..\smn_events.cpp"
>
</File>
<File
RelativePath="..\smn_filesystem.cpp"
>

View File

@ -17,6 +17,8 @@
#include "CConVarManager.h"
#include "CConCmdManager.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "CPlayerManager.h"
static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params)
{
@ -414,7 +416,53 @@ static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
return 1;
}
REGISTER_NATIVES(convarNatives)
static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
{
char buffer[1024];
char *fmt;
int arg = 2;
pCtx->LocalToString(params[1], &fmt);
size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
buffer[res++] = '\n';
buffer[res] = '\0';
META_CONPRINT(buffer);
return 1;
}
static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
{
int index = params[1];
if ((index < 1) || (index > g_Players.GetMaxClients()))
{
return pCtx->ThrowNativeError("Invalid client index %d", index);
}
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
if (!pPlayer->IsInGame())
{
return pCtx->ThrowNativeError("Client %d is not in game", index);
}
char buffer[1024];
char *fmt;
int arg = 3;
pCtx->LocalToString(params[2], &fmt);
size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
buffer[res++] = '\n';
buffer[res] = '\0';
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
return 1;
}
REGISTER_NATIVES(consoleNatives)
{
{"CreateConVar", sm_CreateConVar},
{"FindConVar", sm_FindConVar},
@ -439,5 +487,7 @@ REGISTER_NATIVES(convarNatives)
{"GetCmdArgString", sm_GetCmdArgString},
{"GetCmdArgs", sm_GetCmdArgs},
{"GetCmdArg", sm_GetCmdArg},
{"PrintToServer", sm_PrintToServer},
{"PrintToConsole", sm_PrintToConsole},
{NULL, NULL}
};

View File

@ -159,23 +159,6 @@ static cell_t sm_IsPlayerFakeClient(IPluginContext *pCtx, const cell_t *params)
return (pPlayer->IsFakeClient()) ? 1 : 0;
}
static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
{
char buffer[1024];
char *fmt;
int arg = 2;
pCtx->LocalToString(params[1], &fmt);
size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
buffer[res++] = '\n';
buffer[res] = '\0';
META_CONPRINT(buffer);
return 1;
}
static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
@ -202,35 +185,6 @@ static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
return 1;
}
static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
{
int index = params[1];
if ((index < 1) || (index > g_Players.GetMaxClients()))
{
return pCtx->ThrowNativeError("Invalid client index %d", index);
}
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
if (!pPlayer->IsInGame())
{
return pCtx->ThrowNativeError("Client %d is not in game", index);
}
char buffer[1024];
char *fmt;
int arg = 3;
pCtx->LocalToString(params[2], &fmt);
size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
buffer[res++] = '\n';
buffer[res] = '\0';
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
return 1;
}
static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
@ -402,8 +356,6 @@ REGISTER_NATIVES(playernatives)
{"IsPlayerInGame", sm_IsPlayerIngame},
{"IsClientAuthorized", sm_IsPlayerAuthorized},
{"IsFakeClient", sm_IsPlayerFakeClient},
{"PrintToServer", sm_PrintToServer},
{"PrintToConsole", sm_PrintToConsole},
{"GetClientInfo", sm_GetClientInfo},
{"SetUserAdmin", SetUserAdmin},
{"GetUserAdmin", GetUserAdmin},