CPlayerFuncs

Global player functions

Type: Reference type

Methods

Declaration Description
void SayText(CBasePlayer@ pTargetPlayer, const string& in szText) Says text to a specific player
void SayTextAll(CBasePlayer@ pOriginatingPlayer, const string& in szText) Says text to all players
void ClientPrint(CBasePlayer@ pTargetPlayer, HUD iMsgDest, const string& in szMessage, const string& in szLine2 = "", const string& in szLine3 = "", const string& in szLine4 = "", const string& in szLine5 = "") Prints one or more messages on the HUD of the given player.
See HUD enum.
void ClientPrintAll(HUD iMsgDest, const string& in szMessage, const string& in szLine2 = "", const string& in szLine3 = "", const string& in szLine4 = "", const string& in szLine5 = "") Prints one or more messages on the HUD of all players.
See HUD enum.
void CenterPrintAll(const string& in szMessage, const string& in szLine2 = "", const string& in szLine3 = "", const string& in szLine4 = "", const string& in szLine5 = "") Prints one or more messages centered on the HUD of all players.
void ShowMessage(CBasePlayer@ pTargetPlayer, const string& in szString) Shows a message to the given player.
void ShowMessageAll(const string& in szString) Shows a message to all players.
void HudMessage(CBasePlayer@ pTargetPlayer, const HUDTextParams& in textParams, const string& in szMessage) Shows a HUD message to a given player.
void HudMessageAll(const HUDTextParams& in textParams, const string& in szMessage) Shows a HUD message to all players.
void PrintKeyBindingString(CBasePlayer@ pPlayer, const string& in szString) Prints a string containing key bindings to the screen of the given player.
void PrintKeyBindingStringAll(const string& in szString) Prints a string containing key bindings to the screen of all players.
void HudToggleElement(CBasePlayer@ pTargetPlayer, uint8 iChannel, bool fVisible) Shows or hides HUD element occupying a given channel.
void HudCustomSprite(CBasePlayer@ pTargetPlayer, const HUDSpriteParams& in params) Shows a custom HUD sprite to a given player or to all players if pTargetPlayer is not specified.
void HudNumDisplay(CBasePlayer@ pTargetPlayer, const HUDNumDisplayParams& in params) Shows a custom numeric display to a given player or to all players if pTargetPlayer is not specified.
void HudUpdateNum(CBasePlayer@ pTargetPlayer, uint8 iChannel, float flValue) Updates value of a custom numberic display.
void HudTimeDisplay(CBasePlayer@ pTargetPlayer, const HUDNumDisplayParams& in params) Shows a custom time display to a given player or to all players if pTargetPlayer is not specified.
void HudUpdateTime(CBasePlayer@ pTargetPlayer, uint8 iChannel, float flTime) Updates value of a custom time display.
CBasePlayer@ FindPlayerByIndex(int index) Finds a player by index
CBasePlayer@ FindPlayerByName(const string& in szName, bool bCaseSensitive = true) Finds a player by name
int GetNumPlayers() const Gets the number of players that are currently connected to the server.
void ScreenShake(const Vector& in center, float amplitude, float frequency, float duration, float radius) Shakes the screen for players near a certain location
void ScreenShakeAll(const Vector& in center, float amplitude, float frequency, float duration) Shakes the screen for all players
void ScreenFade(CBaseEntity@ pEntity, const Vector& in color, float fadeTime, float fadeHold, int alpha, int flags) Shows a message to a given player.
void ScreenFadeAll(const Vector& in color, float fadeTime, float fadeHold, int alpha, int flags) Shows a message to all players.
void ConcussionEffect(CBaseEntity@ pEntity, float amplitude, float frequency, float fadeTime) Applies concussion effect to a given player.
bool GetNextBestWeapon(CBasePlayer@ pPlayer, CBasePlayerItem@ pCurrentWeapon) Makes the given player select the next best weapon available, based on the current weapon.
bool CheatsAllowed(CBasePlayer@ pPlayer, const string& in szCheatName, bool fMustBeAlive = true, bool fNoMessage = false) const Returns whether cheats are enabled for the given player.
AdminLevel_t AdminLevel(CBasePlayer@ pPlayer) const Returns the admin level for a given player.
string AdminLevelToString(const AdminLevel_t adminLevel) const Converts the admin level to a string. If the level is an invalid value, an empty string is returned
AdminLevel_t StringToAdminLevel(const string& in szString) const Converts a string containing one of AdminLevelToString's return values to an admin level.Returns ADMIN_NO if the string cannot be converted to a suitable constant
void ApplyMapCfgToPlayer(CBasePlayer@ pPlayer, bool fReEquip = false) Applies the map configuration on the given player.
Will stack if called multiple times, unless fReEquip is true, in which case the player is stripped of all weapons and ammo first.
void RespawnPlayer(CBasePlayer@ pPlayer, bool fMoveLivingPlayers = true, bool fRespawnDeadPlayers = false) Relocates the given player to an active spawn point. If the player is dead and fRespawnDeadPlayers is true, the player is respawned.
void RespawnAllPlayers(bool fMoveLivingPlayers = true, bool fRespawnDeadPlayers = false) Relocates all players to active spawn points. If a player is dead and fRespawnDeadPlayers is true, the player is respawned.
bool SpawnPointFilterPasses(CBaseEntity@ pSpawnEnt, CBaseEntity@ pPlayer) Returns whether the given player passes the given spawn point's filter
bool IsSpawnPointValid(CBaseEntity@ pSpawnEnt, CBaseEntity@ pPlayer) Returns whether the given spawn point is valid for the given player
bool IsSpawnPointOccupied(CBaseEntity@ pSpawnEnt) Returns whether the given spawn point entity is occupied
int SharedRandomLong(uint iRandomSeed, int iLow, int iHigh) Gets a random long whose value is the same on both the client and server.
float SharedRandomFloat(uint iRandomSeed, float iLow, float iHigh) Gets a random float whose value is the same on both the client and server.
int GetAmmoIndex(const string& in szAmmoName) Gets the index of the given ammo, or -1 if it is invalid
CBasePlayer@ CreateBot(const string& in szName) Creates a bot with the given name.
void BotDisconnect(CBasePlayer@ pBot) Disconnects the bot. This will call ClientDisconnect and removes the entity. Do not use the entity after this call.