CityRP Documentation Repository

cityrp.legacy.workarounds

Workarounds Library. Used to fix shit when it doesn't work properly the first time.

Functions

SharedColor(r, g, b, a) → ColorSource ☍

Get a colour structure. Overwritten to prevent client crashes with invalid arguments. Also provides utility for greyscale and gs /w alpha colours. With only r provided, r is copied to r, g and b. Alpha is set to 255. With r and g provided, r is used as r, g and b, alpha is set to g. With r, g, b and optional a provided, function works as default.

Parameters

  • rnumberRed channel.
  • gnumber?Green channel.
  • bnumber?Blue channel.
  • anumber?Alpha channel.

Returns

  1. ColorThe created colour object.
SharedDarkRP.notify(ply, t, time, msg)Source ☍

Notify a player with a message.

Parameters

  • plyPlayerThe player to send the message to.
  • tnumberThe type of the message to send.
  • timenumberIgnored.
  • msgstringThe message to send.
SharedunfuckUnicode(inStr) → stringSource ☍

Unfuck a unicode string, by removing every byte that is not part of a well-formed UTF-8 character. Each invalid byte is dropped on its own, so a stray or truncated byte anywhere in the string never takes a valid neighbour with it. Overlong encodings, UTF-16 surrogates and codepoints above U+10FFFF count as invalid.

Parameters

  • inStrstringThe input string to check.

Returns

  1. stringThe output string, with any invalid UTF-8 removed.

Tables

SharedDarkRPSource ☍