added amb372 (setview)

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401112
This commit is contained in:
David Anderson
2007-07-14 01:30:01 +00:00
parent 9c531423fb
commit ee05ac6cfb
3 changed files with 55 additions and 0 deletions
+24
View File
@@ -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},
};