CreateFireworks: Difference between revisions
From Onset Developer Wiki
No edit summary |
Added a create firework command example |
||
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]] | *[[CreateExplosion]] | ||
*[[CreateFireworks]] | *[[CreateFireworks]] |
Revision as of 19:24, 19 December 2019
Description
__EDIT_ME__
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)