I'm really new to SourceMod extensions, but I'm well versed with c++. How would I access the g_Players global from an extension? For example:
PHP Code:
static cell_t SomeExtensionFunction(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
// g_Players is inside another class-- can't do it
// Is CPlayer in the HL2SDK-l4d2?
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
// etc.
return 1;
}
I guess what I'm really trying to ask is if it's possible to use the nifty functions Sourcemod already provides. Instead of hooking void Hook_ClientPutInServer(edict_t *pEntity, char const *playername) with SH_ADD_HOOK_STATICFUNC/SH_DECL_HOOK2_void etc to reinvent the wheel. Do we use the interface system? I was reading the tutorial but it was very vague.
Also, I know about forwarding to plugins, but is it possible the other way around? Can we use natives created by plugins in extensions?
Thanks