added amb595, eye position and angle natives
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401225
This commit is contained in:
parent
4a6a016790
commit
d05a57fcba
@ -42,6 +42,7 @@ IServerPluginHelpers *pluginhelpers = NULL;
|
||||
IBinTools *g_pBinTools = NULL;
|
||||
IGameConfig *g_pGameConf = NULL;
|
||||
IGameHelpers *g_pGameHelpers = NULL;
|
||||
IServerGameClients *serverClients = NULL;
|
||||
HandleType_t g_CallHandle = 0;
|
||||
HandleType_t g_TraceHandle = 0;
|
||||
|
||||
@ -115,6 +116,7 @@ bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
|
||||
GET_V_IFACE_ANY(engineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
|
||||
GET_V_IFACE_ANY(engineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER);
|
||||
GET_V_IFACE_ANY(engineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||
GET_V_IFACE_ANY(serverFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ extern IEngineTrace *enginetrace;
|
||||
extern IEngineSound *engsound;
|
||||
extern INetworkStringTableContainer *netstringtables;
|
||||
extern IServerPluginHelpers *pluginhelpers;
|
||||
extern IServerGameClients *serverClients;
|
||||
/* Interfaces from SourceMod */
|
||||
extern IBinTools *g_pBinTools;
|
||||
extern IGameConfig *g_pGameConf;
|
||||
|
@ -502,6 +502,59 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t GetClientEyePosition(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]);
|
||||
}
|
||||
|
||||
Vector pos;
|
||||
serverClients->ClientEarPosition(player->GetEdict(), &pos);
|
||||
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
addr[0] = sp_ftoc(pos.x);
|
||||
addr[1] = sp_ftoc(pos.y);
|
||||
addr[2] = sp_ftoc(pos.z);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
static ValveCall *pCall = NULL;
|
||||
if (!pCall)
|
||||
{
|
||||
ValvePassInfo retinfo[1];
|
||||
InitPass(retinfo[0], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
|
||||
if (!CreateBaseCall("EyeAngles", ValveCall_Player, retinfo, NULL, 0, &pCall))
|
||||
{
|
||||
return pContext->ThrowNativeError("\"EyeAngles\" not supported by this mod");
|
||||
} else if (!pCall) {
|
||||
return pContext->ThrowNativeError("\"EyeAngles\" wrapper failed to initialized");
|
||||
}
|
||||
}
|
||||
|
||||
QAngle *ang;
|
||||
START_CALL();
|
||||
DECODE_VALVE_PARAM(1, thisinfo, 0);
|
||||
FINISH_CALL_SIMPLE(&ang);
|
||||
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
addr[0] = sp_ftoc(ang->x);
|
||||
addr[1] = sp_ftoc(ang->y);
|
||||
addr[2] = sp_ftoc(ang->z);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sp_nativeinfo_t g_Natives[] =
|
||||
{
|
||||
{"ExtinguishPlayer", ExtinguishPlayer},
|
||||
@ -517,6 +570,8 @@ sp_nativeinfo_t g_Natives[] =
|
||||
{"SetClientViewEntity", SetClientViewEntity},
|
||||
{"SetLightStyle", SetLightStyle},
|
||||
{"SlapPlayer", SlapPlayer},
|
||||
{"GetClientEyePosition", GetClientEyePosition},
|
||||
{"GetClientEyeAngles", GetClientEyeAngles},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -173,6 +173,11 @@
|
||||
"windows" "126"
|
||||
"linux" "127"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "118"
|
||||
"linux" "119"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,6 +226,11 @@
|
||||
"windows" "126"
|
||||
"linux" "127"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "118"
|
||||
"linux" "119"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,6 +279,11 @@
|
||||
"windows" "126"
|
||||
"linux" "127"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "118"
|
||||
"linux" "119"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,6 +333,11 @@
|
||||
"windows" "124"
|
||||
"linux" "125"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "116"
|
||||
"linux" "117"
|
||||
}
|
||||
|
||||
/* Temp Entities */
|
||||
"TE_GetServerClass"
|
||||
@ -375,6 +395,11 @@
|
||||
"windows" "128"
|
||||
"linux" "129"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "120"
|
||||
"linux" "121"
|
||||
}
|
||||
|
||||
/* Offset into CBaseTempEntity constructor.
|
||||
* On Windows Dsytopia is heavily inlined; we use the function
|
||||
@ -438,6 +463,11 @@
|
||||
"windows" "115"
|
||||
"linux" "116"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "107"
|
||||
"linux" "108"
|
||||
}
|
||||
|
||||
/* Temp Entities */
|
||||
"s_pTempEntities"
|
||||
@ -493,6 +523,11 @@
|
||||
"windows" "126"
|
||||
"linux" "127"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "118"
|
||||
"linux" "119"
|
||||
}
|
||||
|
||||
/* Temp Entities */
|
||||
"s_pTempEntities"
|
||||
@ -543,6 +578,11 @@
|
||||
"windows" "114"
|
||||
"linux" "115"
|
||||
}
|
||||
"EyeAngles"
|
||||
{
|
||||
"windows" "106"
|
||||
"linux" "107"
|
||||
}
|
||||
|
||||
/* Temp Entities */
|
||||
"s_pTempEntities"
|
||||
|
@ -40,3 +40,13 @@ native SetClientViewEntity(client, entity);
|
||||
* @error Light style index is out of range.
|
||||
*/
|
||||
native SetLightStyle(style, const String:value[]);
|
||||
|
||||
/**
|
||||
* Returns the client's eye position.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param pos Destination vector to store the client's eye position.
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native GetClientEyePosition(client, Float:pos[3]);
|
||||
|
@ -104,6 +104,16 @@ native ForcePlayerSuicide(client);
|
||||
*/
|
||||
native SlapPlayer(client, health=5, bool:sound=true);
|
||||
|
||||
/**
|
||||
* Returns the client's eye angles.
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param ang Destination vector to store the client's eye angles.
|
||||
* @noreturn
|
||||
* @error Invalid client index, client not in game, or no mod support.
|
||||
*/
|
||||
native GetClientEyeAngles(client, Float:ang[3]);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user