Skip to content

Extended: Others

dounai2333 edited this page Jan 4, 2025 · 2 revisions

CCSGameRules

GetRoundTime

GameRules:GetRoundTime()

Gets the total round time.

Return: number

SetRoundTime

GameRules:SetRoundTime(time)

Sets the total round time to given value.

time: number

GetRoundStartTime

GameRules:GetRoundStartTime()

Gets the round start time.

Return: number

IsInFreezeTime

GameRules:IsInFreezeTime()

Returns if is in the freeze time.

Return: true or false

string

StartsWith

string:StartsWith(str)

Returns whether or not the first string starts with the second.

Return: true or false

str: string

EndsWith

string:EndsWith(str)

Returns whether or not the second passed string matches the end of the first.

Return: true or false

str: string

Trim

string:Trim()

Removes leading and trailing matches of a string.

Return: string

Split

string:Split(splitstr, fullresult)

Splits the string into a table of strings, separated by the first argument.

When fullresult is true, the table will contain extra content with empty string.

For example: String "1,,2" and split by , will return {"1", "", "2"}. false instead return {"1", "2"}.

Return: table

splitstr: string

fullresult: bool

math

clamp

math.clamp(number, min, max)

Clamps a number between a minimum and maximum value.

Return: number

number: number

min: number

max: number

round

math.round(number, decimals)

Rounds the given value to the nearest whole number or to the given decimal places.

Return: number

number: number

decimals: number

table

contains

table.contains(self, value, ignorefonttext)

Returns true if the table contains the value.

If ignorefonttext is true, when looking for string table it will ignore string like "<font>" and "</font>".

Return: true or false

self: table

value: any

ignorefonttext: bool

Copy

table.Copy(self, tbl)

Creates a deep copy and returns that copy. If tbl is given, will copy to tbl instead.

Return: table

self: table

tbl: table

find

table.find(self, value)

Try find the value in the table, returns true if the given value is found.

BUG: This will only loop the table by using ipair, so it will fail when processing table with string keys.

Return: bool, number

self: table

value: any

findTimer

table.findTimer(self, value)

Internal function, used to find the timer.

Return: bool, number

self: table

value: string

mergeDoubleQuotes

table.mergeDoubleQuotes(self, split_character)

Use with string:Split(), this will merge the string table with double quotes exist.

For example: When giving table {"I", "Love", "You", "\"And", "I", "Love", "You\""}, this function will merge the table to: {"I", "Love", "You", "And I Love You"}.

Make sure split_character is the same value when you split the string.

self: table

split_character: string

shuffle

table.shuffle(self)

Performs an inline Fisher-Yates shuffle on the table in "O(n)" time.

Clone this wiki locally