Skip to content

nut.util

rebel1324 edited this page Dec 25, 2014 · 2 revisions

This library provides function to help you to make something new with NutScript.

Methods

SHARED

  • nut.util.include(fileName, state)
  • Includes the lua file.
  • nut.util.includeDir(directory, fromLua)
  • Includes all lua files in the directory.
  • nut.util.getAdmins(isSuper)
  • Returns table of the admins on the server.
  • nut.util.getMaterial(materialPath)
  • Returns Pre-loaded Material.
  • nut.util.findPlayer(name)
  • Returns a player that includes provided string in thier name.
  • nut.util.stringMatches(a, b)
  • Returns whether string is matches or not (not exactly, but partially.)
  • nut.util.emitQueuedSounds(entity, sounds, delay, spacing, volume, pitch)
  • Emits Queued Sounds.

CLIENTSIDE

  • nut.util.drawBlur(panel, amount, passes)
  • Draws blurs on the panel. Higher passes, Expensive Quality.
  • nut.util.drawBlurAt(x, y, w, h, amount, passes)
  • Draws a blurred rectangle that big as w, h at position x and y with provided amount of passes.
  • nut.util.drawText(text, x, y, color, alignX, alignY, font, alpha)
  • Draws a text on certain position with provided parameter.

SERVERSIDE

  • nut.util.findEmptySpace(entity, filter, spacing, size, height, tolerance)
  • Find and Return Empty Space near around the entity.

Meta Functions

Entity

  • Entity:isDoor()
  • Returns whether the entity is door or not.
  • Entity:getDoorPartner()
  • Returns the entity that tied together with provied entity object.
  • Entity:blastDoor(velocity, lifeTime, ignorePartner)
  • Blasts door with veloctiy. The door will be restored after certain amount of the time. If ignorePartner is true, This function will blow all partner with the entity.

Player

SHARED

  • Player:isWepRaised()
  • Returns the Weapon Raise status of the player.
  • Player:isRunning()
  • Returns whether player is running or not (Whether player is moving above Default Waling Speed of the player.)
  • Player:isFemale()
  • Returns whether player is playing as female model or not. (This "Female Model" means there is "female" word on the model. (For defualt, this function checks 'female', 'alyx', 'mossman')
  • Player:getItemDropPos()
  • Returns the Good Item Dropping Position for the player.
  • Player:isStuck()
  • Returns whether player is stuck or not.
  • Player:setRagdolled(state, time, getUpGrace)
  • Set player ragdolled for certain amount of time if state is true.

SERVERSIDE

  • Player:setWepRaised(state)
  • Set player's weapon raising state.
  • Player:toggleWepRaised()
  • Toggles player's weapon rasing state.
  • Player:setAction(text, time, callback, startTime, finishTime)
  • Set Current Action of the player.
    This function will display a progress bar on the screen of the player. If the progress bar runs out, The callback function will run.
Clone this wiki locally