This repository has been archived by the owner on May 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserver.lua
41 lines (34 loc) · 1.85 KB
/
server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--[[
SecurityVans - spawn multiple vans and rob them.
Copyright (C) 2018 FiveM-Scripts
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with SecurityVans in the file "LICENSE". If not, see <http://www.gnu.org/licenses/>.
]]
AddEventHandler('onResourceStart', function()
local version = GetResourceMetadata(GetCurrentResourceName(), 'version', 0)
PerformHttpRequest("https://updates.fivem-scripts.org/verify/" .. GetCurrentResourceName(), function(err, rData, headers)
print("\nStarting SecurityVans ".. version .."\n----------------------------------------------------")
if err == 404 then
print("\nUPDATE ERROR: your version could not be verified.\n")
print("Verify that the folder in your resources directory is named SecurityVans.")
print("\n----------------------------------------------------")
else
local vData = json.decode(rData)
if vData.version ~= version then
print("You are running an outdated version of " .. GetCurrentResourceName() ..".")
print("Please get the latest version from our GitHub page.")
print("----------------------------------------------------")
else
print("You are running the latest version of ".. GetCurrentResourceName() ..".\n----------------------------------------------------")
end
end
end, "GET", "", {["Content-Type"] = 'application/json'})
end)