ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getParticleCount

Function

getParticleCount

ClientParticlesTrilogy Hub only

Returns the number of living particles of the emitter. An emitter further than maxDistance from the camera computes nothing and returns 0.

Syntax

int getParticleCount(element emitter)

Arguments

emitterelement
The emitter.

Returns

The particle count or false.

Example

A counter of all living particles in the screen corner.

addEventHandler("onClientRender", root, function()
    local total = 0
    for _, emitter in ipairs(getElementsByType("particle")) do
        total = total + getParticleCount(emitter)
    end
    dxDrawText("Cząsteczki: " .. total, 20, 20)
end)

Notes

Client only: every player simulates a server emitter's particles on their own.

See also