I find it odd that it returned a non-NULL value. maxplayers is a
ConCommand, not a ConVar.

The typical way to get the max players is to get the IPlayerInfoManager
interface, call GetGlobalVars, and then check the maxClients global value.

-- 
Nicholas Hastings
AlliedMods.net <http://www.alliedmods.net>



> Tom Schumann <mailto:schumann....@gmail.com>
> Friday, July 7, 2017 9:47 PM
> Thanks - I used g_pCVar->FindVar which returns a ConVar* but its m_pParent
> attribute is NULL so I can't get its value.
> I tried wrapping it in a ConVarRef and GetInt, GetFloat and GetString all
> return 0. I can see that maxplayers is 16 though.
>
> On 25 June 2017 at 21:06, Nicholas Hastings <psycho...@alliedmods.net>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>
> Nicholas Hastings <mailto:psycho...@alliedmods.net>
> Sunday, June 25, 2017 7:06 AM
> It's the same as getting them from within a game dll.
>
> Call ConnectTier1Libraries or manually look up and set g_pCVar to the
> ICVar interface pointer (CVAR_INTERFACE_VERSION). After then you can use
> ConVarRefs or manual lookup, ex. g_pCVar->FindVar("mp_friendlyfire") .
>
> Tom Schumann <mailto:schumann....@gmail.com>
> Sunday, June 25, 2017 1:31 AM
> Is there a way to get a game .dll or engine cvar value from a Source
> plugin? I've had a bit of a poke around and couldn't see or find anything
> obvious.
>
> Thanks
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Reply via email to