CreateFireworks: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|CreateFireworks(modelid, x, y, z, rx, ry, rz)}} <div class="noprint" style="float:right;"> File:f..." |
m Updated description |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Creates fireworks that shoot upwards and explode. ModelId presets contain various shapes/styles of fireworks.}} | ||
{{FuncSyntax|CreateFireworks(modelid, x, y, z, rx, ry, rz)}} | {{FuncSyntax|CreateFireworks(modelid, x, y, z, rx, ry, rz)}} | ||
Line 8: | Line 8: | ||
</div> | </div> | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|modelid|Id for fireworks preset.}} | {{FuncParam|modelid|Id for fireworks preset (1-13).}} | ||
{{FuncParam|x|World X location.}} | {{FuncParam|x|World X location.}} | ||
{{FuncParam|y|World Y location.}} | {{FuncParam|y|World Y location.}} | ||
{{FuncParam|z|World Z location.}} | {{FuncParam|z|World Z location.}} | ||
{{FuncParam|rx|Pitch rotation. Should be 90 to have the fireworks shoot up.}} | {{FuncParam|rx|Pitch rotation. Should be 90.0 to have the fireworks shoot up.}} | ||
{{FuncParam|ry|Yaw rotation.}} | {{FuncParam|ry|Yaw rotation.}} | ||
{{FuncParam|rz|Roll rotation.}} | {{FuncParam|rz|Roll rotation.}} | ||
Line 19: | Line 19: | ||
== Example == | == Example == | ||
'''Client:''' | |||
<syntaxhighlight lang="Lua> | |||
function ClientCreateFireworks(type) | |||
local x, y, z = GetPlayerLocation() | |||
CreateFireworks(type, x, y, z + 150, 90, 0, 0) | |||
end | |||
AddRemoteEvent("ClientCreateFireworks", ClientCreateFireworks) | |||
</syntaxhighlight> | |||
'''Server:''' | |||
<syntaxhighlight lang="Lua> | |||
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) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
*[[CreateExplosion]] | |||
*[[CreateFireworks]] |
Latest revision as of 19:25, 19 December 2019
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)