added amb372 (setview)
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401112
This commit is contained in:
parent
9c531423fb
commit
ee05ac6cfb
@ -274,6 +274,29 @@ static cell_t TeleportPlayer(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
|
||||
if (player == NULL)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid client index %d", params[1]);
|
||||
}
|
||||
if (!player->IsInGame())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not in game", params[1]);
|
||||
}
|
||||
|
||||
edict_t *pEdict = engine->PEntityOfEntIndex(params[2]);
|
||||
if (!pEdict || pEdict->IsFree())
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
|
||||
}
|
||||
|
||||
engine->SetView(player->GetEdict(), pEdict);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sp_nativeinfo_t g_Natives[] =
|
||||
{
|
||||
{"ExtinguishPlayer", ExtinguishPlayer},
|
||||
@ -285,6 +308,7 @@ sp_nativeinfo_t g_Natives[] =
|
||||
{"RemovePlayerItem", RemovePlayerItem},
|
||||
{"TeleportPlayer", TeleportPlayer},
|
||||
{"TeleportEntity", TeleportPlayer},
|
||||
{"SetClientViewEntity", SetClientViewEntity},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define _sdktools_included
|
||||
|
||||
#include <core>
|
||||
#include <sdktools_engine>
|
||||
#include <sdktools_functions>
|
||||
#include <sdktools_tempents>
|
||||
#include <sdktools_tempents_stocks>
|
||||
|
30
plugins/include/sdktools_engine.inc
Normal file
30
plugins/include/sdktools_engine.inc
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* ===============================================================
|
||||
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
||||
* ===============================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used
|
||||
* or modified under the Terms and Conditions of its License Agreement, which is found
|
||||
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
|
||||
* may change at any time. To view the latest information, see:
|
||||
* http://www.sourcemod.net/license.php
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#if defined _sdktools_engine_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _sdktools_engine_included
|
||||
|
||||
/**
|
||||
* Sets a client's "viewing entity."
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param entity Entity index.
|
||||
* @noreturn
|
||||
* @error Invalid client or entity, lack of mod support, or client not in
|
||||
* game.
|
||||
*/
|
||||
native SetClientViewEntity(client, entity);
|
Loading…
Reference in New Issue
Block a user