CreateFireworks

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
CreateFireworks

Type: Function
Context: Client
Introduced: v1.0

Description

Creates fireworks that shoot upwards and explode. ModelId presets contain various shapes/styles of fireworks.

Syntax

CreateFireworks(modelid, x, y, z, rx, ry, rz)

Parameters

  • modelid
    Id for fireworks preset (1-13).
  • x
    World X location.
  • y
    World Y location.
  • z
    World Z location.
  • rx
    Pitch rotation. Should be 90.0 to have the fireworks shoot up.
  • ry
    Yaw rotation.
  • rz
    Roll rotation.

Return Value

  • Returns true on success.

Example

Client:

function ClientCreateFireworks(type)
	local x, y, z = GetPlayerLocation()
	CreateFireworks(type, x, y, z + 150, 90, 0, 0)
end
AddRemoteEvent("ClientCreateFireworks", ClientCreateFireworks)

Server:

function cmd_fireworks(player, type)
	if (type == nil) then
		return AddPlayerChat(player, "Usage: /fireworks <type 1-13>")
	end
	
	type = tonumber(type)

	if (type < 0 or type > 13) then
		return AddPlayerChat(player, "Parameter \"type\" 1-13")
	end

	CallRemoteEvent(player, "ClientCreateFireworks", type)
	AddPlayerChat(player, "Fireworks created!")
end
AddCommand("fireworks", cmd_fireworks)

See also