Misc

A generic module that holds anything that doesnt fit elsewhere

Functions

SizeH(height)

View source »

Scales size to fit different resolutions better. Write sizes based on 1080p resolution.

Parameters

  • height int

    Height based on 1080P.

Returns

  • int

    Height scaled to client resolution.

SizeW(width)

View source »

Scales size to fit different resolutions better. Write sizes based on 1080p resolution.

Parameters

  • width int

    Width based on 1080P.

Returns

  • int

    Width scaled to client resolution.

SizeWH(width, height)

View source »

Scales size to fit different resolutions better. Write sizes based on 1080p resolution.

Parameters

  • width int

    Width based on 1080P.

  • height int

    Height based on 1080P.

Returns

  • int

    Width scaled to client resolution.

  • int

    Height scaled to client resolution.

impulse.AngleToBearing(ang)

View source »

Angle to bearing function...? I dunno how this is useful to the framework but hey it works.

Parameters

  • ang

Returns

  • int

    Bearing.

impulse.BlurRect(x, y, w, h)

View source »

Blurs a rectangle at specified points.

Parameters

  • x int

    X pos.

  • y int

    Y pos.

  • w int

    Width.

  • h int

    Height.

impulse.CanUseDesc(desc)

View source »

Determines if you can use a description for your RP character.

Parameters

  • desc string

    Description to test.

Returns

  • bool

    Can use.

impulse.CanUseName(name)

View source »

Checks if a name is good enough to use.

Parameters

  • name string

    The name to test.

Returns

  • bool

    Can this name be used?

  • string

    The message to display if it cannot be used.

Example Usage

local canUse, reason = impulse.CanUseName("john") -- Returns false, too short.

impulse.CinematicIntro(message)

View source »

Displays a cinematic message to all players on the server.

Parameters

  • message string

    Message to appear in the cinematic intro.

impulse.FindByDatabaseId(id)

View source »

Finds a player by their database id.

Parameters

  • id int

    The id of the player.

Returns

  • entity

    The player.

impulse.FindByDatabaseIdOnTeam(id, teamId)

View source »

Finds a player by their database id and if they are on a specific team.

Parameters

  • id int

    The id of the player.

  • teamId int

    the id of the team.

Returns

  • entity

    The player.

impulse.FindEmptyPos(pos, ignore, distance, step, area)

Deprecated

This is a deprecated function! You are able to use it, but you risk breaking code when the function is eventually removed..

View source »

Finds an empty position nearby, pretty broken though.

Parameters

  • pos vector

    Position to look around.

  • ignore

    Entity list to ignore.

  • distance int

    The distance to move around to find a new space.

  • step int

    The amount of change in a move.

  • area int

    Honestly dunno what this one does.

Returns

  • vector

    Position.

impulse.FindPlayer(searchKey)

View source »

Finds a player by a specific search key, if not found returns nil.

Parameters

  • searchKey string

    Players name, RP name, or Steam ID 32.

Returns

  • Player

    Player found, or nil.

impulse.GetRandomAmbientVO(gender)

View source »

This is used for Vendors.

Parameters

  • gender string

    male, fisherman, cp, zombie, or female.

Returns

  • sound

    This is a sound path, not a CSoundPatch or anything.

impulse.IsEmpty(vector, ignore)

View source »

Checks if a vector position is empty.

Parameters

  • vector vector

    World position.

  • ignore

    Entity list to ignore, this should be a table.

Returns

  • bool

    is Empty.

impulse.MakeWorkbar(time, text, onDone, popup)

View source »

Creates a work bar on the players screen

Parameters

  • time int

    The time it will take to complete the bar

  • text string optional

    Text to display on the bar

  • onDone function optional

    Called when bar is complete

  • popup boolean default: false

    If the bar should stop player input

impulse.PosToCode(pos)

View source »

Turns a vector into code,.

Parameters

  • pos vector

    The vector to turn into a code.

Returns

  • string

    The vector written as code.

impulse.PosToString(pos)

View source »

Decomposes a vector and separates each part with "|".

Parameters

  • pos vector

    The vector to turn into a string.

Returns

  • string

    The readable version of the vector.

impulse.SafeString(str)

View source »

Removes bad characters from strings.

Parameters

  • str string

    The input string.

Returns

impulse.ViewBob(pos, ang, fov)

View source »

Returns the camera with realistic viewbobbing

Parameters

  • pos vector

    Position of the camera

  • ang angle

    Angle of the camera

  • fov number

    Field of view of the camera

Returns

impulse.blur(panel, layers, density, alpha)

View source »

Renders a blur effect on a panel. Call this inside PANEL:Paint

Parameters

  • panel

    The panel to blur

  • layers int

    Unknown

  • density int

    Density

  • alpha color

    Alpha