cityrp
CityRP Functions Library.
Functions
GetByID(id)
View source »Get a player from their User ID.
Parameters
-
id
number
User ID.
Returns
-
false or Player
Player if found, otherwise false.
comma_value(amount)
View source »Format a number in a human readable format.
Parameters
-
amount
number
Number to format.
formattime(time, showmins)
View source »Format a unix timestamp into a human readable time difference.
Parameters
-
time
number
Time to format.
-
showmins
number or bool
default: false
If minutes should always be shown, or what number of units should be shown.
Returns
-
string
Formatted time difference.
msg_admins(msg)
View source »Send a ChatPrint message to all online administrators.
Parameters
-
msg
string
Message to send.
msg_mods(msg)
View source »Send a ChatPrint message to all online moderators.
Parameters
-
msg
string
Message to send.
mysql_escape(str)
This function is deprecated and may be removed in a future version.
This is a security risk and will be removed.
a really fucking shit mysql "escaping" function.
Parameters
-
str
string
Input string.
Returns
-
string
"Escaped" string.
parseTimeString(str)
View source »Parse a time string (such as used by bans) into a number of minutes.
Parameters
-
str
string
Time String, such as "12d".
Returns
-
int
Number of minutes this time string represents.
Example Usage
cityrp.parseTimeString("30") -> 30
cityrp.parseTimeString("1h") -> 60
cityrp.parseTimeString("1h30") -> 90
replacecodes(str, ply)
View source »Replace wildcard codes in a given string.
Parameters
-
str
string
The string to base on.
-
ply
Player
The player the replacement is based on.
Returns
-
string
The replaced string.
stringifyList(tab, noOxford)
View source »Converts a list into a string, split by commas and ended with an "and".
Parameters
-
tab
tab
Sequential table of stringables.
-
noOxford
bool
default: false
Disable the Oxford Comma. Hethen.
Returns
-
string
Stringified List
Example Usage
cityrp.stringifyList({"string"}) -> "string"
cityrp.stringifyList({"string", "array"}) -> "string and array"
cityrp.stringifyList({"string", "array", "integer"}) -> "string, array, and integer"