baso88 / SC_AngelScript

Sven Co-op AngelScript documentation, tutorials, sample code and tools
41 stars 4 forks source link

CPlayerFuncs::AdminLevel should have overload that takes edict_t@ #45

Open fnky opened 7 years ago

fnky commented 7 years ago

CPlayerFuncs::AdminLevel returns the admin level of the given player. Unfortunately, it takes a CBasePlayer@ (like the underlying AdminLevel function it forwards to) so you can't use it in the ClientConnected and CanPlayerUseReservedSlot hooks.

Users may want to verify the player's admin level in those hooks to check if they should be allowed to join, which is impossible because it requires a CBasePlayer.

Add an overload that takes an edict_t@ so this can be done. (I'm aware that CBasePlayer's members are accessed when checking for an admin level, just refactor the function into 2 parts so the edict only part at the end can be called at any time)