# CDOTAGamerules

全局访问变量:GameRules

Function Description Client
handle AddBotPlayerWithEntityScript(string_1, string_2, int_3, string_4) Spawn a bot player of the passed hero name, player name, and team.
bool AddEventMetadataLeaderboardEntry(string_1, unsigned_2, unsigned_3, unsigned_4, unsigned_5, unsigned_6, unsigned_7, unsigned_8, unsigned_9) Event-only ( string szNameSuffix, int nStars, int nMaxStars, int nExtraData1, int nExtraData2 )
void AddItemToWhiteList(string_1) Add an item to the whitelist
void AddMinimapDebugPoint(int_1, Vector_2, int_3, int_4, int_5, int_6, float_7) Add a point on the minimap.
void AddMinimapDebugPointForTeam(int_1, Vector_2, int_3, int_4, int_5, int_6, float_7, int_8) Add a point on the minimap for a specific team.
void BeginNightstalkerNight(float_1) Begin night stalker night.
void BeginTemporaryNight(float_1) Begin temporary night.
void BotPopulate() Fills all the teams with bots if cheat mode is enabled.
void Defeated() Kills the ancient, etc.
bool DidMatchSignoutTimeOut() true when we have waited some time after end of the game and not received signout
void EnableCustomGameSetupAutoLaunch(bool_1) Enabled (true) or disable (false) auto launch for custom game setup.
void FinishCustomGameSetup() Indicate that the custom game setup phase is complete, and advance to the game.
void ForceCreepSpawn() Spawn the next wave of creeps.
void ForceGameStart() Transition game state to DOTA_GAMERULES_STATE_GAME_IN_PROGRESS
int GetCustomGameDifficulty() Returns the difficulty level of the custom game mode ✔️
int GetCustomGameTeamMaxPlayers(int_1) Get whether a team is selectable during game setup
float GetDOTATime(IncludePregameTime , IncludeNegativeTime) (b IncludePregameTime b IncludeNegativeTime) Returns the actual DOTA in-game clock time.
返回Dota游戏内的时间。(是否包含赛前时间或负时间) ✔️
int GetDifficulty() Returns difficulty level of the custom game mode ✔️
handle GetDroppedItem(int_1) Gets the Xth dropped item
float GetGameFrameTime() Returns the number of seconds elapsed since the last frame was renderered. This time doesn't count up when the game is paused ✔️
handle GetGameModeEntity() Get the game mode entity
string GetGameSessionConfigValue(string_1, string_2) Get a string value from the game session config (map options)
float GetGameTime() Returns the number of seconds elapsed since map start. This time doesn't count up when the game is paused ✔️
uint64 GetMatchID() Get the MatchID for this game.
bool GetMatchSignoutComplete() Have we received the post match signout message that includes reward information
int GetNianTotalDamageTaken() For New Bloom, get total damage taken by the Nian / Year Beast
table GetPlayerCustomGameAccountRecord(int_1) (Preview/Unreleased) Gets the player's custom game account record, as it looked at the start of this session
float GetStateTransitionTime() Get time remaining between state changes.
float GetTimeOfDay() Get the time of day
Vector GetWeatherWindDirection() Get Weather Wind Direction Vector ✔️
bool IsCheatMode() Are cheats enabled on the server ✔️
bool IsDaytime() Is it day time?
bool IsGamePaused() Returns whether the game is paused.
bool IsHeroRespawnEnabled() Returns whether hero respawn is enabled.
bool IsInBanPhase() Are we in the ban phase of hero pick?
bool IsItemInWhiteList(string_1) Query an item in the whitelist
bool IsNightstalkerNight() Is it night stalker night-time?
bool IsTemporaryNight() Is it temporarily night-time?
void LockCustomGameSetupTeamAssignment(bool_1) Lock (true) or unlock (false) team assignemnt. If team assignment is locked players cannot change teams.
void MakeTeamLose(int_1) Makes the specified team lose
int NumDroppedItems() Returns the number of items currently dropped on the ground
bool PlayerHasCustomGameHostPrivileges(handle_1) Whether a player has custom game host privileges (shuffle teams, etc.)
void Playtesting_UpdateAddOnKeyValues() Updates custom hero, unit and ability KeyValues in memory with the latest values from disk
void PrepareSpawners(float_1) Prepare Dota lane style spawners with a given interval
void RemoveItemFromWhiteList(string_1) Remove an item from the whitelist
void ResetDefeated() Restart after killing the ancient, etc.
void ResetGameTime() Restart gametime from 0
void ResetToCustomGameSetup() Restart at custom game setup.
void ResetToHeroSelection() Restart the game at hero selection
void SendCustomMessage(string_1, int_2, int_3) Sends a message on behalf of a player.
void SendCustomMessageToTeam(string_1, int_2, int_3, int_4) Sends a message on behalf of a player to the specified team.
void SetCreepMinimapIconScale(float_1) (flMinimapCreepIconScale) - Scale the creep icons on the minimap.
void SetCreepSpawningEnabled(bool_1) Sets whether the regular Dota creeps spawn.
void SetCustomGameAccountRecordSaveFunction(handle_1, handle_2) (Preview/Unreleased) Sets a callback to handle saving custom game account records (callback is passed a Player ID and should return a flat simple table)
void SetCustomGameAllowBattleMusic(bool_1) Sets a flag to enable/disable the default music handling code for custom games
void SetCustomGameAllowHeroPickMusic(bool_1) Sets a flag to enable/disable the default music handling code for custom games
void SetCustomGameAllowMusicAtGameStart(bool_1) Sets a flag to enable/disable the default music handling code for custom games
void SetCustomGameDifficulty(int_1) Set the difficulty level of the custom game mode
void SetCustomGameEndDelay(float_1) Sets the game end delay.
void SetCustomGameSetupAutoLaunchDelay(float_1) Set the amount of time to wait for auto launch.
void SetCustomGameSetupRemainingTime(float_1) Set the amount of remaining time, in seconds, for custom game setup. 0 = finish immediately, -1 = wait forever
void SetCustomGameSetupTimeout(float_1) Setup (pre-gameplay) phase timeout. 0 = instant, -1 = forever (until FinishCustomGameSetup is called)
void SetCustomGameTeamMaxPlayers(int_1, int_2) Set whether a team is selectable during game setup
void SetCustomVictoryMessage(string_1) Sets the victory message.
void SetCustomVictoryMessageDuration(float_1) Sets the victory message duration.
bool SetEventMetadataCustomTable(handle_1) Event-only ( table hMetadataTable )
bool SetEventSignoutCustomTable(handle_1) Event-only ( table hMetadataTable )
void SetFirstBloodActive(bool_1) Sets whether First Blood has been triggered.
void SetGameWinner(int_1) Makes the specified team win
void SetGoldPerTick(int_1) Set the auto gold increase per timed interval.
void SetGoldTickTime(float_1) Set the time interval between auto gold increases.
void SetHeroMinimapIconScale(float_1) (flMinimapHeroIconScale) - Scale the hero minimap icons on the minimap.
void SetHeroRespawnEnabled(bool_1) Control if the normal DOTA hero respawn rules apply.
void SetHeroSelectPenaltyTime(float_1) Sets amount of penalty time before randoming a hero
void SetHeroSelectionTime(float_1) Sets the amount of time players have to pick their hero.
void SetHideKillMessageHeaders(bool_1) Sets whether the multikill, streak, and first-blood banners appear at the top of the screen.
void SetOverlayHealthBarUnit(handle_1, int_2) Show this unit's health on the overlay health bar
void SetPostGameTime(float_1) Sets the amount of time players have between the game ending and the server disconnecting them.
void SetPreGameTime(float_1) Sets the amount of time players have between picking their hero and game start.
void SetRuneMinimapIconScale(float_1) (flMinimapRuneIconScale) - Scale the rune icons on the minimap.
void SetRuneSpawnTime(float_1) Sets the amount of time between rune spawns.
void SetSafeToLeave(bool_1) (bSafeToLeave) - Mark this game as safe to leave.
void SetSameHeroSelectionEnabled(bool_1) When true, players can repeatedly pick the same hero.
void SetShowcaseTime(float_1) Sets the amount of time players have between the strategy phase and entering the pre-game phase.
void SetStartingGold(int_1) Set the starting gold amount.
void SetStrategyTime(float_1) Sets the amount of time players have between the hero selection and entering the showcase phase.
void SetTimeOfDay(float_1) Set the time of day.
void SetTreeRegrowTime(float_1) Sets the tree regrow time in seconds.
void SetUseBaseGoldBountyOnHeroes(bool_1) Heroes will use the basic NPC functionality for determining their bounty, rather than DOTA specific formulas.
void SetUseCustomHeroXPValues(bool_1) Allows heroes in the map to give a specific amount of XP (this value must be set).
void SetUseUniversalShopMode(bool_1) When true, all items are available at as long as any shop is in range.
void SetWeatherWindDirection(Vector_1) Set Weather Wind Direction Vector
void SetWhiteListEnabled(bool_1) Item whitelist functionality enable/disable
void SpawnAndReleaseCreeps() Spawn and release the next creep wave from Dota lane style spawners.
int State_Get() Get the current Gamerules state ✔️