Client side:
function fdbell()
local Sound = playSound3D( "alarm/firealarm.mp3", 1725, -1130, 24, false )
setElementInterior(Sound, getElementInterior(localPlayer))
setElementDimension(Sound, getElementDimension(localPlayer))
setSoundMinDistance(Sound, 25)
setSoundMaxDistance(Sound, 70)
-- setSoundVolume( Sound, 1 )
end
addEvent("ringTheBell", true)
addEventHandler("ringTheBell", root, fdbell)
function loadthescript()
outputChatBox("Script loaded -- debug")
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), loadthescript)
addCommandHandler("bell", fdbell)
function fdfire(commandName, fireid)
if fireid then
if tonumber(fireid) == 1 then
createFire(1700, -1168, 23, 60)
createFire(1698, -1168, 23, 60)
local blipicon = createBlip( 1700, -1168, 23, 43, 0, 0, 0, 255 )
outputChatBox("Fire created at 1700, -1168, 23")
local onlinePlayers = getElementsByType("player")
for index, player in pairs(onlinePlayers) do
local x, y, z = getElementPosition(player)
local distance = getDistanceBetweenPoints3D(1725, -1130, 24, x, y, z)
if (distance <50) then
setTimer(function ()
destroyElement(blipicon)
end, 900000, 1)
setTimer(function ()
triggerEvent("ringTheBell", player)
end, 5000, 1)
end
end
elseif tonumber(fireid) == 2 then
createFire(1729, -1174, 23, 60)
createFire(1727, -1174, 23, 60)
local blipicon = createBlip( 1729, -1174, 23, 43, 0, 0, 0, 255 )
outputChatBox("Fire created at 1729, -1174, 23")
local onlinePlayers = getElementsByType("player")
for index, player in pairs(onlinePlayers) do
local x, y, z = getElementPosition(player)
local distance = getDistanceBetweenPoints3D(1725, -1130, 24, x, y, z)
if (distance <50) then
setTimer(function ()
destroyElement(blipicon)
end, 900000, 1)
setTimer(function ()
triggerEvent("ringTheBell", player)
end, 5000, 1)
end
end
else
outputChatBox("Missing ID")
end
else
outputChatBox("Syntax: /fdfire [id]", thePlayer)
outputChatBox("IDs available: 1, 2", thePlayer)
end
end
-- addCommandHandler("fdfire", fdfire)
addEvent ( "createfdfire", true )
addEventHandler ( "createfdfire", getRootElement(), fdfire )
Server side:
function makeitburn (player, commandName, fdfire)
triggerClientEvent( "createfdfire", getRootElement(), fdfire )
end
addCommandHandler ( "fdfire", makeitburn )
Issue is it doesn't get the numer I type (1 or 2) after /fdfire. It always outputs the syntax as if there was no number.