Module functions
Generic Shared Functions
Module Overview
Server Functions
| mysql_escape(str) | Escape a string, for use in mysql statements. |
| msg_admins(msg) | Send a message to all connected admins. |
| msg_mods(msg) | Send a message to all connected moderators / admins. |
| msg_devs(msg) | Send a message to all connected developers. |
| FixVehicleCollision(vehicle) | Fix the collisions of a vehicle. |
| SetClipboardText(ply, text) | Set a player's clipboard text. |
Shared Functions
| cityrp.formattime(time[, showmins]) | Format a number as a time string. |
| stringTimeToMins(str) | Turn a time string into a number of minutes. |
| cityrp.GetByID(id) | Get a user by their user ID. |
| table.copy(orig) | Create a deep copy of a value, including metatables for tables. |
| comma_value(amount) | Create a comma'd value f rom a number. |
| empty(t) | Check if a table is empty. |
| tonumber(str[, base=10]) | Convert string to number. |
| ENT:FacingTowards(ent[, fov=90]) | Check if an entity is facing towards another entity, within the given Field of View angle. |
| IsInsideBox(pos, point1, point2) | Check if a point inside a box defined by the two corners. |
| cityrp.replacecodes(ply, str) | Replace player substitution codes in a string. |
| LookupEnum(value, prefix) | Lookup an enumeration, given its prefix and value. |
| FormatList(tList) | Format a list as a string. |
Server Functions
| mysql_escape(str) | Escape a string, for use in mysql statements. |
| msg_admins(msg) | Send a message to all connected admins. |
| msg_mods(msg) | Send a message to all connected moderators / admins. |
| msg_devs(msg) | Send a message to all connected developers. |
| FixVehicleCollision(vehicle) | Fix the collisions of a vehicle. |
| SetClipboardText(ply, text) | Set a player's clipboard text. |
- mysql_escape(str)
-
Escape a string, for use in mysql statements.
Parameters:
- str string Input string.
Returns:
-
string
Escaped string.
- msg_admins(msg)
-
Send a message to all connected admins.
Parameters:
- msg string The message to send.
- msg_mods(msg)
-
Send a message to all connected moderators / admins.
Parameters:
- msg string The message to send.
- msg_devs(msg)
-
Send a message to all connected developers.
Parameters:
- msg string The message to send.
- FixVehicleCollision(vehicle)
-
Fix the collisions of a vehicle.
Parameters:
- vehicle Entity The vehicle to fix collisions for.
- SetClipboardText(ply, text)
-
Set a player's clipboard text.
Parameters:
- cityrp.formattime(time[, showmins])
-
Format a number as a time string.
Parameters:
- time number The number of seconds to format.
- showmins bool Whether to show the minutes in the time string. (optional)
Returns:
-
string
Formatted time string.
- stringTimeToMins(str)
-
Turn a time string into a number of minutes.
Strings with only a number are counted as minutes.
Parameters:
- str string The input time string.
Returns:
-
int
Number of minutes.
- cityrp.GetByID(id)
-
Get a user by their user ID.
Parameters:
- id number The UserID to search for.
Returns:
-
Entity or bool
Either the found entity, or false if none was found.
- table.copy(orig)
-
Create a deep copy of a value, including metatables for tables.
Parameters:
- orig value to copy.
Returns:
-
A deep copy of orig.
- comma_value(amount)
-
Create a comma'd value f rom a number.
Identical to string.Comma
Parameters:
- amount number The input number.
Returns:
-
string
The comma'd value.
- empty(t)
-
Check if a table is empty.
Parameters:
- t tab The table to check.
Returns:
-
boolean
Empty state.
- tonumber(str[, base=10])
-
Convert string to number.
Handles nan and inf.
Parameters:
- str string The number to pass.
- base number The base to convert the string. (default 10)
Returns:
-
optional number
The converted number or nil.
- ENT:FacingTowards(ent[, fov=90])
-
Check if an entity is facing towards another entity, within the given Field of View angle.
Parameters:
- ent Entity The entity to check.
- fov number The FOV of the entity. (default 90)
Returns:
-
boolean
If the entity is facing towards the other entity.
- IsInsideBox(pos, point1, point2)
-
Check if a point inside a box defined by the two corners.
Parameters:
- pos Vector The position to check.
- point1 Vector First corner of the box.
- point2 Vector The opposite corner of the box.
Returns:
-
boolean
If the pos is inside the box.
- cityrp.replacecodes(ply, str)
-
Replace player substitution codes in a string.
Parameters:
Returns:
-
string
The string with codes replaced.
- LookupEnum(value, prefix)
-
Lookup an enumeration, given its prefix and value.
Parameters:
- value The value of the enumeration.
- prefix string The prefix of the param to lookup.
Returns:
-
string
The key of the found enum, or an empty string if not found.
- FormatList(tList)
-
Format a list as a string.
Seperates the last item with "and", using commas otherwise.
If there is only one item, it returns just that item.
Parameters:
- tList tab Input list to format.
Returns:
-
string
Formatted string.
- mysql_escape(str)
-
Escape a string, for use in mysql statements.
Parameters:
- str string Input string.
Returns:
-
string
Escaped string.
- msg_admins(msg)
-
Send a message to all connected admins.
Parameters:
- msg string The message to send.
- msg_mods(msg)
-
Send a message to all connected moderators / admins.
Parameters:
- msg string The message to send.
- msg_devs(msg)
-
Send a message to all connected developers.
Parameters:
- msg string The message to send.
- FixVehicleCollision(vehicle)
-
Fix the collisions of a vehicle.
Parameters:
- vehicle Entity The vehicle to fix collisions for.
- SetClipboardText(ply, text)
-
Set a player's clipboard text.
Parameters: