diff --git a/client/main.lua b/client/main.lua index 9642e10..67dd6f2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -36,12 +36,12 @@ TriggerEvent('chat:addSuggestion', '/stopfire', 'Stops the fire', { TriggerEvent('chat:addSuggestion', '/stopallfires', 'Stops all fires') -TriggerEvent('chat:addSuggestion', '/registerfire', 'Registers a new fire configuration') +TriggerEvent('chat:addSuggestion', '/registerscenario', 'Registers a new fire configuration') -TriggerEvent('chat:addSuggestion', '/addflame', 'Adds a flame to a registered fire', { +TriggerEvent('chat:addSuggestion', '/addflame', 'Adds a flame to a scenario', { { - name = "fireID", - help = "The registered fire" + name = "scenarioID", + help = "The scenario" }, { name = "spread", @@ -53,9 +53,9 @@ TriggerEvent('chat:addSuggestion', '/addflame', 'Adds a flame to a registered fi } }) -TriggerEvent('chat:addSuggestion', '/removeflame', 'Removes a flame from a registered fire', { +TriggerEvent('chat:addSuggestion', '/removeflame', 'Removes a flame from a scenario', { { - name = "fireID", + name = "scenarioID", help = "The fire ID" }, { @@ -64,16 +64,16 @@ TriggerEvent('chat:addSuggestion', '/removeflame', 'Removes a flame from a regis } }) -TriggerEvent('chat:addSuggestion', '/removefire', 'Removes a registered fire', { +TriggerEvent('chat:addSuggestion', '/removescenario', 'Removes a scenario', { { - name = "fireID", + name = "scenarioID", help = "The fire ID" } }) -TriggerEvent('chat:addSuggestion', '/startregisteredfire', 'Starts a registered fire', { +TriggerEvent('chat:addSuggestion', '/startscenario', 'Starts a scenario', { { - name = "fireID", + name = "scenarioID", help = "The fire ID" }, { @@ -82,9 +82,9 @@ TriggerEvent('chat:addSuggestion', '/startregisteredfire', 'Starts a registered } }) -TriggerEvent('chat:addSuggestion', '/stopregisteredfire', 'Stops a registered fire', { +TriggerEvent('chat:addSuggestion', '/stopscenario', 'Stops a scenario', { { - name = "fireID", + name = "scenarioID", help = "The fire ID" } }) @@ -134,7 +134,7 @@ TriggerEvent('chat:addSuggestion', '/randomfires', 'Manages the random fire spaw }, { name = "p2", - help = "(optional) For add / remove action, fill in the registered fire ID." + help = "(optional) For add / remove action, fill in the scenario ID." } }) @@ -206,9 +206,9 @@ RegisterCommand( ) RegisterCommand( - 'registerfire', + 'registerscenario', function(source, args, rawCommand) - TriggerServerEvent('fireManager:command:registerfire', GetEntityCoords(GetPlayerPed(-1))) + TriggerServerEvent('fireManager:command:registerscenario', GetEntityCoords(GetPlayerPed(-1))) end, false ) @@ -227,6 +227,40 @@ RegisterCommand( false ) +-- Aliases + +RegisterCommand( + 'registerfire', + function(source, args, rawCommand) + ExecuteCommand("registerscenario" .. rawCommand:sub(13)) + end, + false +) + +RegisterCommand( + 'removeregisteredfire', + function(source, args, rawCommand) + ExecuteCommand("removescenario" .. rawCommand:sub(21)) + end, + false +) + +RegisterCommand( + 'startregisteredfire', + function(source, args, rawCommand) + ExecuteCommand("startscenario" .. rawCommand:sub(20)) + end, + false +) + +RegisterCommand( + 'stopregisteredfire', + function(source, args, rawCommand) + ExecuteCommand("stopscenario" .. rawCommand:sub(19)) + end, + false +) + --================================-- -- EVENTS -- --================================-- diff --git a/server/main.lua b/server/main.lua index efb7a48..5e65e7b 100644 --- a/server/main.lua +++ b/server/main.lua @@ -72,7 +72,7 @@ AddEventHandler( local fireIndex = Fire:create(coords, maxSpread, chance) - sendMessage(source, "Created fire #" .. fireIndex) + sendMessage(source, "Spawned fire #" .. fireIndex) if triggerDispatch then Citizen.SetTimeout( @@ -88,9 +88,9 @@ AddEventHandler( end ) -RegisterNetEvent('fireManager:command:registerfire') +RegisterNetEvent('fireManager:command:registerscenario') AddEventHandler( - 'fireManager:command:registerfire', + 'fireManager:command:registerscenario', function(coords) if not Whitelist:isWhitelisted(source, "firescript.manage") then sendMessage(source, "Insufficient permissions.") @@ -99,7 +99,7 @@ AddEventHandler( local registeredFireID = Fire:register(coords) - sendMessage(source, "Registered fire #" .. registeredFireID) + sendMessage(source, "Created scenario #" .. registeredFireID) end ) @@ -123,11 +123,11 @@ AddEventHandler( local flameID = Fire:addFlame(registeredFireID, coords, spread, chance) if not flameID then - sendMessage(source, "No such fire registered.") + sendMessage(source, "No such scenario.") return end - sendMessage(source, "Registered flame #" .. flameID) + sendMessage(source, "Added flame #" .. flameID) end ) @@ -209,7 +209,7 @@ RegisterCommand( ) RegisterCommand( - 'removefire', + 'removescenario', function(source, args, rawCommand) if not Whitelist:isWhitelisted(source, "firescript.manage") then sendMessage(source, "Insufficient permissions.") @@ -223,17 +223,17 @@ RegisterCommand( local success = Fire:deleteRegistered(registeredFireID) if not success then - sendMessage(source, "No such fire or flame registered.") + sendMessage(source, "No such scenario.") return end - sendMessage(source, "Removed fire #" .. registeredFireID) + sendMessage(source, "Removed scenario #" .. registeredFireID) end, false ) RegisterCommand( - 'startregisteredfire', + 'startscenario', function(source, args, rawCommand) if not Whitelist:isWhitelisted(source, "firescript.start") then sendMessage(source, "Insufficient permissions.") @@ -250,17 +250,17 @@ RegisterCommand( local success = Fire:startRegistered(registeredFireID, triggerDispatch, source) if not success then - sendMessage(source, "No such fire or flame registered.") + sendMessage(source, "No such scenario.") return end - sendMessage(source, "Started registered fire #" .. registeredFireID) + sendMessage(source, "Started scenario #" .. registeredFireID) end, false ) RegisterCommand( - 'stopregisteredfire', + 'stopscenario', function(source, args, rawCommand) if not Whitelist:isWhitelisted(source, "firescript.stop") then sendMessage(source, "Insufficient permissions.") @@ -276,11 +276,11 @@ RegisterCommand( local success = Fire:stopRegistered(registeredFireID) if not success then - sendMessage(source, "No such fire active.") + sendMessage(source, "No such scenario active.") return end - sendMessage(source, "Stopping registered fire #" .. registeredFireID) + sendMessage(source, "Stopping scenario #" .. registeredFireID) TriggerClientEvent("pNotify:SendNotification", source, { text = "Fire going out...", @@ -395,14 +395,14 @@ RegisterCommand( return end Fire:setRandom(registeredFireID, true) - sendMessage(source, ("Set registered fire #%s to spawn randomly."):format(registeredFireID)) + sendMessage(source, ("Set scenario #%s to start randomly."):format(registeredFireID)) elseif action == "remove" then if not registeredFireID then sendMessage(source, "Invalid argument (2).") return end Fire:setRandom(registeredFireID, false) - sendMessage(source, ("Set registered fire #%s not to spawn randomly."):format(registeredFireID)) + sendMessage(source, ("Set scenario #%s not to start randomly."):format(registeredFireID)) elseif action == "disable" then Fire:stopSpawner() sendMessage(source, "Disabled random fire spawn.") @@ -506,9 +506,11 @@ RegisterNetEvent('fireDispatch:create') AddEventHandler( 'fireDispatch:create', function(text, coords) - if not Config.Dispatch.disableCalls and Dispatch.expectingInfo[source] then + if not Config.Dispatch.disableCalls and (source < 1 or Dispatch.expectingInfo[source]) then Dispatch:create(text, coords) - Dispatch.expectingInfo[source] = nil + if source > 0 then + Dispatch.expectingInfo[source] = nil + end end end )