How to use Non-Looped Particle FX in FiveM (One-Shot Effects)
How to use Non-Looped Particle FX in FiveM
Non-Looped Particle Effects are effects that are played once and are over — suitable for explosion, impact, bullet impact, or flash of any kind.
Native Functions for Non-Looped
-- Play at world coordinates (x, y, z)
StartParticleFxNonLoopedAtCoord(
effectName, -- string: effect name
x, y, z, -- float: coordinates
rotX, rotY, rotZ, -- float: rotation
scale, -- float: scale (1.0 = normal)
xAxis, yAxis, zAxis -- bool: flip axis
)
-- Play on Entity (Character/Car/Object)
StartParticleFxNonLoopedOnEntity(
effectName,
entity, -- entity handle
offsetX, offsetY, offsetZ, -- offset from entity
rotX, rotY, rotZ,
scale,
xAxis, yAxis, zAxis
)
-- Played on the Entity's Bone.
StartParticleFxNonLoopedOnEntityBone(
effectName,
entity,
offsetX, offsetY, offsetZ,
rotX, rotY, rotZ,
boneIndex, -- int: bone index
scale,
xAxis, yAxis, zAxis
)
Example: Explosion Effect
local function PlayExplosionEffect(coords)
-- Request dictionary
RequestNamedPtfxAsset("scr_rcbarry2")
while not HasNamedPtfxAssetLoaded("scr_rcbarry2") do
Citizen.Wait(0)
end
-- play effect
UseParticleFxAssetNextCall("scr_rcbarry2")
StartParticleFxNonLoopedAtCoord(
"scr_exp_clown_explode",
coords.x, coords.y, coords.z,
0.0, 0.0, 0.0,
2.0, -- scale is 2 times larger.
false, false, false
)
-- Release asset after use
RemoveNamedPtfxAsset("scr_rcbarry2")
end
Example: Bullet hits the ground.
local function BulletImpactEffect(coords)
RequestNamedPtfxAsset("core")
while not HasNamedPtfxAssetLoaded("core") do
Citizen.Wait(0)
end
UseParticleFxAssetNextCall("core")
StartParticleFxNonLoopedAtCoord(
"ent_sht_dirt", -- Dust splashes
coords.x, coords.y, coords.z,
0.0, 0.0, 0.0,
0.5,
false, false, false
)
end
Popular Effect for Non-Looped
| Effect Name | Dictionary | Description |
|---|---|---|
exp_grd_grenade |
core |
ground level grenade |
exp_air_molotov |
core |
Molotov cocktail |
ent_sht_dirt |
core |
Dust splashes |
ent_sht_blood |
core |
blood spatter |
scr_exp_clown_explode |
scr_rcbarry2 |
Big Explosion |
muz_pistol_b |
core |
flash bullet pistol |
Best Practice: Cleanup after use
-- Asset should be removed after non-looped effect.
-- to free VRAM
RemoveNamedPtfxAsset("core")
Note: The "core" dictionary is used very often — it may be kept in memory forever, but specialized dictionaries (such as
scr_*) should be removed after use.
Summary
Non-Looped Effects are easy to use, no lifecycle management required — just play and you're done. Suitable for all types of impact/explosion.
Related Articles
วิธีจัดการ Version และ Update Script ในเซิร์ฟเวอร์ FiveM อย่างมืออาชีพ
อัพเดท script บน production โดยไม่ให้เซิร์ฟเวอร์ down — เรียนรู้ระบบจัดการ version, Git workflow, และกลยุทธ์ deploy ที่ลดความเสี่ยง
หลักการ Clean Code สำหรับ FiveM Script Developer
โค้ดที่ทำงานได้กับโค้ดที่ดีไม่ใช่สิ่งเดียวกัน — เรียนรู้หลักการ clean code ที่ทำให้ FiveM script ของคุณอ่านง่าย, แก้ง่าย และขยายได้
วิธีทดสอบ FiveM Script ก่อน Deploy ขึ้น Production Server
อย่า deploy script ที่ยังไม่ผ่านการทดสอบลงบน production — เรียนรู้วิธีสร้าง testing workflow สำหรับ FiveM ที่ลด downtime และป้องกัน bug จากผู้เล่นจริง