Skip to content

nut.flag

Brian edited this page Jul 2, 2015 · 3 revisions

This library handles the flag system which handles certain permissions for players easily. Note that the character methods in this library may say flags, but the methods also support a single flag.

Methods

  • nut.flag.add(flag, desc[, callback])
  • A shared function to setup a flag. The flag itself should be one character. The callback is called server-side during the player's loadout or when the flag is taken/removed. The callback passes the affected player and a boolean of whether or not the flag is being given.
  • nut.flag.onSpawn(client)
  • A server-side function to run all the loadout callbacks for all of a player's flags.

Extensions

Character

  • character:setFlags(flags)
  • Sets the stored flags for a character to the set string. This does not handle flag callbacks.
  • character:giveFlags(flags)
  • Gives a character one or more flags. Each flag has its callback ran if applicable.
  • character:takeFlags(flags)
  • Similar to giving flags, except the flag or flags are removed from the character's stored flags. The callback for each flag removed is ran.
  • character:getFlags()
  • Returns all of the character's flags in one string.
  • character:hasFlags(flags)
  • Returns a boolean of whether or not the character has at least one of the flags specified.

Clone this wiki locally