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:
parent
43051a0571
commit
03e70ebe16
@ -199,10 +199,6 @@
|
|||||||
RelativePath="..\CDbgReporter.cpp"
|
RelativePath="..\CDbgReporter.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\CGameEventManager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CLogger.cpp"
|
RelativePath="..\CLogger.cpp"
|
||||||
>
|
>
|
||||||
@ -661,10 +657,6 @@
|
|||||||
RelativePath="..\smn_datapacks.cpp"
|
RelativePath="..\smn_datapacks.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\smn_events.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\smn_filesystem.cpp"
|
RelativePath="..\smn_filesystem.cpp"
|
||||||
>
|
>
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include "CConVarManager.h"
|
#include "CConVarManager.h"
|
||||||
#include "CConCmdManager.h"
|
#include "CConCmdManager.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
#include "CPlayerManager.h"
|
||||||
|
|
||||||
static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params)
|
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;
|
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},
|
{"CreateConVar", sm_CreateConVar},
|
||||||
{"FindConVar", sm_FindConVar},
|
{"FindConVar", sm_FindConVar},
|
||||||
@ -439,5 +487,7 @@ REGISTER_NATIVES(convarNatives)
|
|||||||
{"GetCmdArgString", sm_GetCmdArgString},
|
{"GetCmdArgString", sm_GetCmdArgString},
|
||||||
{"GetCmdArgs", sm_GetCmdArgs},
|
{"GetCmdArgs", sm_GetCmdArgs},
|
||||||
{"GetCmdArg", sm_GetCmdArg},
|
{"GetCmdArg", sm_GetCmdArg},
|
||||||
|
{"PrintToServer", sm_PrintToServer},
|
||||||
|
{"PrintToConsole", sm_PrintToConsole},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -159,23 +159,6 @@ static cell_t sm_IsPlayerFakeClient(IPluginContext *pCtx, const cell_t *params)
|
|||||||
return (pPlayer->IsFakeClient()) ? 1 : 0;
|
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)
|
static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
@ -202,35 +185,6 @@ static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
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)
|
static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
@ -402,8 +356,6 @@ REGISTER_NATIVES(playernatives)
|
|||||||
{"IsPlayerInGame", sm_IsPlayerIngame},
|
{"IsPlayerInGame", sm_IsPlayerIngame},
|
||||||
{"IsClientAuthorized", sm_IsPlayerAuthorized},
|
{"IsClientAuthorized", sm_IsPlayerAuthorized},
|
||||||
{"IsFakeClient", sm_IsPlayerFakeClient},
|
{"IsFakeClient", sm_IsPlayerFakeClient},
|
||||||
{"PrintToServer", sm_PrintToServer},
|
|
||||||
{"PrintToConsole", sm_PrintToConsole},
|
|
||||||
{"GetClientInfo", sm_GetClientInfo},
|
{"GetClientInfo", sm_GetClientInfo},
|
||||||
{"SetUserAdmin", SetUserAdmin},
|
{"SetUserAdmin", SetUserAdmin},
|
||||||
{"GetUserAdmin", GetUserAdmin},
|
{"GetUserAdmin", GetUserAdmin},
|
||||||
|
Loading…
Reference in New Issue
Block a user