From 29c40e2098a4dfbccbbb7ab532d36f3f99effe42 Mon Sep 17 00:00:00 2001 From: Dawson Godin <33760026+DevDawson@users.noreply.github.com> Date: Sun, 22 Mar 2020 23:54:30 -0700 Subject: [PATCH] Added serverId to be configurable --- server.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server.lua b/server.lua index 7a3ba45..4d17319 100644 --- a/server.lua +++ b/server.lua @@ -4,8 +4,9 @@ local communityID = "" local apiKey = "" local apiURL = 'https://sonorancad.com/api/emergency' -local postTime = 5000 --Recommended to stay above 5000ms -local serverType = "" -- Either specify "standalone" or "esx", "standalone" will use your Steam Name as the Caller ID, and "esx" will use "esx-identity" to use your character's name. +local postTime = 5000 --Recommended to stay above 5000ms3 +local serverId = "1" -- Default is 1 +local serverType = "standalone" -- Either specify "standalone" or "esx", "standalone" will use your Steam Name as the Caller ID, and "esx" will use "esx-identity" to use your character's name. --------------------------------------------------------------------------- -- Server Event Handling **DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING** @@ -127,7 +128,7 @@ RegisterCommand('911', function(source, args, rawCommand) -- Getting the Steam Name local standCaller = GetPlayerName(source) -- Sending the API event - TriggerEvent('cadSendCallApi', true, standCaller, callLocation, description, source) + TriggerEvent('cadSendCallApi', true, standCaller, callLocation, description) -- Sending the user a message stating the call has been sent TriggerClientEvent('chatMessage', source, "^5^*[SonoranCAD]^r^7 Your call has been sent to the dispatch. Help is now on the way!") elseif serverType == "esx" then @@ -166,7 +167,7 @@ RegisterCommand('311', function(source, args, rawCommand) -- Getting the Steam Name local standCaller = GetPlayerName(source) -- Sending the API event - TriggerEvent('cadSendCallApi', false, standCaller, callLocation, description, source) + TriggerEvent('cadSendCallApi', false, standCaller, callLocation, description) -- Sending the user a message stating the call has been sent TriggerClientEvent('chatMessage', source, "^5^*[SonoranCAD]^r^7 Your call has been sent to the dispatch. Help is now on the way!") elseif serverType == "esx" then @@ -188,5 +189,5 @@ end, false) RegisterServerEvent('cadSendCallApi') AddEventHandler('cadSendCallApi', function(emergency, caller, location, description) PerformHttpRequest(apiURL, function(statusCode, res, headers) - end, "POST", json.encode({['id'] = communityID, ['key'] = apiKey, ['type'] = 'CALL_911', ['data'] = {{['serverId'] = '1', ['isEmergency'] = emergency, ['caller'] = caller, ['location'] = location, ['description'] = description}}}), {["Content-Type"]="application/json"}) + end, "POST", json.encode({['id'] = communityID, ['key'] = apiKey, ['type'] = 'CALL_911', ['data'] = {{['serverId'] = serverId, ['isEmergency'] = emergency, ['caller'] = caller, ['location'] = location, ['description'] = description}}}), {["Content-Type"]="application/json"}) end)