Skip to content

SprayMesh Extended

Chev edited this page Nov 6, 2023 · 4 revisions

Hooks

A list of hooks for SprayMesh Extended can be found here.

Shared

None

Server

SprayMesh.ShouldAllowSpray

Determines whether or not a spray should be placed.

This is serverside, meaning if the spray is blocked, it will be blocked for all players.

Arguments

  1. Player ply: The owner of the incoming spray.
  2. table tr: The TraceResult data of the incoming spray.

Returns

Return false to block the spray for all players, return anything else to allow it

Example

This example blocks sprays for users who are muted (via ULX/ULib).

hook.Add("SprayMesh.ShouldAllowSpray", "SprayMesh.ULXMute", function(ply, tr)
    -- Block this player from placing their spray if they are muted (via ULX)
    if ply.gimp then return false end
end)

SprayMesh.OnSpraySent

Called when a spray is sent to all connected players.

Arguments

  1. Player ply: The owner of the spray.
  2. string url: The URL of the spray.
  3. Vector hitpos: The trace result hit position of the spray. In simplified terms, this is simply the spray's position in the world.

Returns

Does not return anything

Example

Log placed sprays to ULX logs.

hook.Add("SprayMesh.OnSpraySent", "SprayMesh.LogPlacedSpraysToULX", function(ply, url, hitpos)
    local formatMsg = Format(
        "[SprayMesh Extended] %s (Steam ID %s) placed a spray at %s (URL: %s)",
        ply:Nick(),
        ply:SteamID64(),
        hitpos,
        url
    )

    ulx.logString(formatMsg)
end)

Client

SprayMesh.ClientShouldAllowSpray

Determines whether or not a spray should be placed.

This is clientside, meaning if the spray is blocked, it will only be blocked for that client.

Arguments

  1. table sprayData: The SprayData table (contains things like the player's Steam ID 64, player name, spray position, normal, etc.)

Returns

Return false to block the spray for the client, return anything else to allow it

Clone this wiki locally