oh one native for the hat man teame
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40665
This commit is contained in:
parent
daeb5a7dba
commit
708a3a9a5c
@ -207,6 +207,28 @@ static cell_t IsSoundPrecached(IPluginContext *pContext, const cell_t *params)
|
||||
return enginesound->IsSoundPrecached(sample) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(params[1]);
|
||||
|
||||
if (!pPlayer)
|
||||
{
|
||||
return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
|
||||
}
|
||||
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pContext->ThrowNativeError("Player %d is not connected", params[1]);
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
g_SourceMod.FormatString(buffer, sizeof(buffer)-1, pContext, params, 2);
|
||||
|
||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(halflifeNatives)
|
||||
{
|
||||
{"CreateFakeClient", CreateFakeClient},
|
||||
@ -229,5 +251,6 @@ REGISTER_NATIVES(halflifeNatives)
|
||||
{"IsGenericPrecached", IsGenericPrecached},
|
||||
{"PrecacheSound", PrecacheSound},
|
||||
{"IsSoundPrecached", IsSoundPrecached},
|
||||
{"FakeClientCommand", FakeClientCommand},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
@ -31,6 +31,7 @@ CallClass<IServerGameDLL> *gamedllPatch = NULL;
|
||||
IPlayerInfoManager *playerinfo = NULL;
|
||||
IBaseFileSystem *basefilesystem = NULL;
|
||||
IEngineSound *enginesound = NULL;
|
||||
IServerPluginHelpers *serverpluginhelpers = NULL;
|
||||
|
||||
PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
|
||||
|
||||
@ -46,6 +47,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
||||
GET_V_IFACE_CURRENT(engineFactory, engrandom, IUniformRandomStream, VENGINE_SERVER_RANDOM_INTERFACE_VERSION);
|
||||
GET_V_IFACE_CURRENT(fileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
|
||||
GET_V_IFACE_CURRENT(engineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
||||
GET_V_IFACE_CURRENT(engineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||
|
||||
/* :TODO: Make this optional and... make it find earlier versions [?] */
|
||||
GET_V_IFACE_CURRENT(serverFactory, playerinfo, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
||||
|
@ -61,6 +61,7 @@ extern IUniformRandomStream *engrandom;
|
||||
extern IPlayerInfoManager *playerinfo;
|
||||
extern IBaseFileSystem *basefilesystem;
|
||||
extern IEngineSound *enginesound;
|
||||
extern IServerPluginHelpers *serverpluginhelpers;
|
||||
|
||||
#define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func)
|
||||
#define SERVER_CALL(func) SH_CALL(gamedllPatch, &IServerGameDLL::func)
|
||||
|
@ -387,5 +387,16 @@ native bool:PrecacheSound(const String:sound[], bool:preload=false);
|
||||
*/
|
||||
native bool:IsSoundPrecached(const String:sound[]);
|
||||
|
||||
/**
|
||||
* Executes a client command on the server without being networked.
|
||||
*
|
||||
* @param client Index of the client.
|
||||
* @param fmt Format of the client command.
|
||||
* @param ... Format parameters
|
||||
* @noreturn
|
||||
* @error Invalid client index, or client not connected.
|
||||
*/
|
||||
native FakeClientCommand(client, const String:fmt[], any:...);
|
||||
|
||||
#include <helpers>
|
||||
#include <entity>
|
||||
|
Loading…
Reference in New Issue
Block a user