mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
1.0.0!
- Added a server export to toggle plate lock on a client - Removed old and redundant code - Added the licence to the top of every file - Added a small section at the bottom of config.lua to set the default UI element scale, as well as the safezone - Changed the height of the UI settings box to stop the slider and close button from overlapping - Added the ability to disable server console messages - Formatted all code to tab size 4!
This commit is contained in:
@@ -1,9 +1,34 @@
|
|||||||
--[[-----------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
-----------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
READER = {}
|
READER = {}
|
||||||
|
|
||||||
@@ -104,7 +129,7 @@ function READER:GetCamLocked( cam )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Locks the given reader
|
-- Locks the given reader
|
||||||
function READER:LockCam( cam, playAudio, isBolo )
|
function READER:LockCam( cam, playBeep, isBolo )
|
||||||
-- Check that plate readers can actually be locked
|
-- Check that plate readers can actually be locked
|
||||||
if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then
|
if ( PLY:VehicleStateValid() and self:CanPerformMainTask() ) then
|
||||||
-- Toggle the lock state
|
-- Toggle the lock state
|
||||||
@@ -115,11 +140,16 @@ function READER:LockCam( cam, playAudio, isBolo )
|
|||||||
|
|
||||||
-- Play a beep
|
-- Play a beep
|
||||||
if ( self:GetCamLocked( cam ) ) then
|
if ( self:GetCamLocked( cam ) ) then
|
||||||
if ( playAudio ) then
|
if ( playBeep ) then
|
||||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "plateAudio" ) } )
|
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "plateAudio" ) } )
|
||||||
end
|
end
|
||||||
|
|
||||||
TriggerEvent( "wk:onPlateLocked", cam, self:GetPlate( cam ), self:GetIndex( cam ) )
|
if ( isBolo ) then
|
||||||
|
SendNUIMessage( { _type = "audio", name = "plate_hit", vol = RADAR:GetSettingValue( "plateAudio" ) } )
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Trigger an event so developers can hook into the scanner every time a plate is locked
|
||||||
|
TriggerServerEvent( "wk:onPlateLocked", cam, self:GetPlate( cam ), self:GetIndex( cam ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -138,6 +168,11 @@ function READER:GetCamFromNum( relPos )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RegisterNetEvent( "wk:togglePlateLock" )
|
||||||
|
AddEventHandler( "wk:togglePlateLock", function( cam, beep, bolo )
|
||||||
|
READER:LockCam( cam, beep, bolo )
|
||||||
|
end )
|
||||||
|
|
||||||
-- Runs when the "Toggle Display" button is pressed on the plate reder box
|
-- Runs when the "Toggle Display" button is pressed on the plate reder box
|
||||||
RegisterNUICallback( "togglePlateReaderDisplay", function()
|
RegisterNUICallback( "togglePlateReaderDisplay", function()
|
||||||
-- Toggle the display state
|
-- Toggle the display state
|
||||||
@@ -162,7 +197,7 @@ function READER:Main()
|
|||||||
-- Get a start position 5m in front/behind the player's vehicle
|
-- Get a start position 5m in front/behind the player's vehicle
|
||||||
local start = GetOffsetFromEntityInWorldCoords( PLY.veh, 0.0, ( 5.0 * i ), 0.0 )
|
local start = GetOffsetFromEntityInWorldCoords( PLY.veh, 0.0, ( 5.0 * i ), 0.0 )
|
||||||
|
|
||||||
-- Get the end position 40m in front/behind the player's vehicle
|
-- Get the end position 50m in front/behind the player's vehicle
|
||||||
local offset = GetOffsetFromEntityInWorldCoords( PLY.veh, -2.5, ( 50.0 * i ), 0.0 )
|
local offset = GetOffsetFromEntityInWorldCoords( PLY.veh, -2.5, ( 50.0 * i ), 0.0 )
|
||||||
|
|
||||||
-- Run the ray trace to get a vehicle
|
-- Run the ray trace to get a vehicle
|
||||||
@@ -201,14 +236,14 @@ function READER:Main()
|
|||||||
if ( plate == self:GetBoloPlate() ) then
|
if ( plate == self:GetBoloPlate() ) then
|
||||||
self:LockCam( cam, false, true )
|
self:LockCam( cam, false, true )
|
||||||
|
|
||||||
SendNUIMessage( { _type = "audio", name = "plate_hit", vol = RADAR:GetSettingValue( "plateAudio" ) } )
|
-- SendNUIMessage( { _type = "audio", name = "plate_hit", vol = RADAR:GetSettingValue( "plateAudio" ) } )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send the plate information to the NUI side to update the UI
|
-- Send the plate information to the NUI side to update the UI
|
||||||
SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } )
|
SendNUIMessage( { _type = "changePlate", cam = cam, plate = plate, index = index } )
|
||||||
|
|
||||||
-- Trigger the event so developers can hook into the scanner
|
-- Trigger the event so developers can hook into the scanner every time a plate is scanned
|
||||||
TriggerEvent( "wk:onPlateScanned", cam, plate, index )
|
TriggerServerEvent( "wk:onPlateScanned", cam, plate, index )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
111
cl_radar.lua
111
cl_radar.lua
@@ -1,9 +1,34 @@
|
|||||||
--[[----------------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
----------------------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
-- Cache some of the main Lua functions and libraries
|
-- Cache some of the main Lua functions and libraries
|
||||||
local next = next
|
local next = next
|
||||||
@@ -23,7 +48,7 @@ Citizen.SetTimeout( 1000, function()
|
|||||||
local name = GetCurrentResourceName()
|
local name = GetCurrentResourceName()
|
||||||
|
|
||||||
-- Print a little message in the client's console
|
-- Print a little message in the client's console
|
||||||
print( "WK_WARS2X: Sending resource name (" .. name .. ") to JavaScript side." )
|
print( "[wk_wars2x]: Sending resource name (" .. name .. ") to JavaScript side." )
|
||||||
|
|
||||||
-- Send a message through the NUI system to the JavaScript file to give the name of the resource
|
-- Send a message through the NUI system to the JavaScript file to give the name of the resource
|
||||||
SendNUIMessage( { _type = "updatePathName", pathName = name } )
|
SendNUIMessage( { _type = "updatePathName", pathName = name } )
|
||||||
@@ -51,6 +76,12 @@ AddEventHandler( "wk:loadUiData", function( data )
|
|||||||
SendNUIMessage( { _type = "loadUiSettings", data = data } )
|
SendNUIMessage( { _type = "loadUiSettings", data = data } )
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
RegisterNetEvent( "wk:setUiDefaults" )
|
||||||
|
AddEventHandler( "wk:setUiDefaults", function()
|
||||||
|
SendNUIMessage( { _type = "setUiDefaults", data = CONFIG.uiDefaults } )
|
||||||
|
end )
|
||||||
|
|
||||||
|
|
||||||
--[[----------------------------------------------------------------------------------
|
--[[----------------------------------------------------------------------------------
|
||||||
Player info variables
|
Player info variables
|
||||||
----------------------------------------------------------------------------------]]--
|
----------------------------------------------------------------------------------]]--
|
||||||
@@ -158,6 +189,7 @@ RADAR.vars =
|
|||||||
lockedType = nil -- The locked type, 1 = strongest, 2 = fastest
|
lockedType = nil -- The locked type, 1 = strongest, 2 = fastest
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Variables for the rear antenna
|
||||||
[ "rear" ] = {
|
[ "rear" ] = {
|
||||||
xmit = false, -- Whether the antenna is transmitting or in hold
|
xmit = false, -- Whether the antenna is transmitting or in hold
|
||||||
mode = 0, -- Current antenna mode, 0 = none, 1 = same, 2 = opp, 3 = same and opp
|
mode = 0, -- Current antenna mode, 0 = none, 1 = same, 2 = opp, 3 = same and opp
|
||||||
@@ -377,28 +409,6 @@ function RADAR:OpenRemote()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Updates the operator menu option indexes, as the default menu values can be changed in the config, we
|
|
||||||
-- need to update the indexes otherwise the menu will display the wrong values
|
|
||||||
function RADAR:UpdateOptionIndexes()
|
|
||||||
-- Iterate through each of the internal settings
|
|
||||||
for k, v in pairs( self.vars.settings ) do
|
|
||||||
-- Iterate through all of the menu options
|
|
||||||
for i, t in pairs( self.vars.menuOptions ) do
|
|
||||||
-- If the current menu option is the same as the current setting
|
|
||||||
if ( t.settingText == k ) then
|
|
||||||
-- Iterate through the option values of the current menu option
|
|
||||||
for oi, ov in pairs( t.options ) do
|
|
||||||
-- If the value of the current option set in the config matches the current value of
|
|
||||||
-- the option value, then we update the option index variable
|
|
||||||
if ( v == ov ) then
|
|
||||||
t.optionIndex = oi
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns if the fast limit option should be available for the radar
|
-- Returns if the fast limit option should be available for the radar
|
||||||
function RADAR:IsFastLimitAllowed()
|
function RADAR:IsFastLimitAllowed()
|
||||||
return CONFIG.allow_fast_limit
|
return CONFIG.allow_fast_limit
|
||||||
@@ -594,6 +604,28 @@ function RADAR:SendMenuUpdate()
|
|||||||
SendNUIMessage( { _type = "menu", text = self:GetMenuOptionDisplayText(), option = self:GetMenuOptionText() } )
|
SendNUIMessage( { _type = "menu", text = self:GetMenuOptionDisplayText(), option = self:GetMenuOptionText() } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Updates the operator menu option indexes, as the default menu values can be changed in the config, we
|
||||||
|
-- need to update the indexes otherwise the menu will display the wrong values
|
||||||
|
function RADAR:UpdateOptionIndexes()
|
||||||
|
-- Iterate through each of the internal settings
|
||||||
|
for k, v in pairs( self.vars.settings ) do
|
||||||
|
-- Iterate through all of the menu options
|
||||||
|
for i, t in pairs( self.vars.menuOptions ) do
|
||||||
|
-- If the current menu option is the same as the current setting
|
||||||
|
if ( t.settingText == k ) then
|
||||||
|
-- Iterate through the option values of the current menu option
|
||||||
|
for oi, ov in pairs( t.options ) do
|
||||||
|
-- If the value of the current option set in the config matches the current value of
|
||||||
|
-- the option value, then we update the option index variable
|
||||||
|
if ( v == ov ) then
|
||||||
|
t.optionIndex = oi
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[----------------------------------------------------------------------------------
|
--[[----------------------------------------------------------------------------------
|
||||||
Radar basics functions
|
Radar basics functions
|
||||||
@@ -1110,28 +1142,6 @@ function RADAR:InsertCapturedVehicleData( t, rt )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
These need to be changed so a ray type can be set too, otherwise in its current state, messes up vehicle
|
|
||||||
detection.
|
|
||||||
|
|
||||||
-- Sets the given value to true in the temp vehicles table, it is a test system used to reduce ray traces
|
|
||||||
-- on vehicles that have already been hit by another trace. Currently not implemented fully, as it doesn't
|
|
||||||
-- check for ray traces of different types, e.g. same or opp.
|
|
||||||
function RADAR:HasVehicleAlreadyBeenHit( key )
|
|
||||||
return self.vars.tempVehicleIDs[key]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns if a vehicle has already been hit by a ray trace
|
|
||||||
function RADAR:SetVehicleHasBeenHit( key )
|
|
||||||
self.vars.tempVehicleIDs[key] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Resets the temporary vehicle ids table
|
|
||||||
function RADAR:ResetTempVehicleIDs()
|
|
||||||
self.vars.tempVehicleIDs = {}
|
|
||||||
end
|
|
||||||
]]
|
|
||||||
|
|
||||||
|
|
||||||
--[[----------------------------------------------------------------------------------
|
--[[----------------------------------------------------------------------------------
|
||||||
Radar dynamic sphere radius functions
|
Radar dynamic sphere radius functions
|
||||||
@@ -1600,8 +1610,6 @@ function RADAR:Main()
|
|||||||
|
|
||||||
-- Send the update to the NUI side
|
-- Send the update to the NUI side
|
||||||
SendNUIMessage( { _type = "update", speed = data.patrolSpeed, antennas = data.antennas } )
|
SendNUIMessage( { _type = "update", speed = data.patrolSpeed, antennas = data.antennas } )
|
||||||
|
|
||||||
-- self:ResetTempVehicleIDs()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1723,11 +1731,6 @@ function RunControlManager()
|
|||||||
RADAR:ToggleFullKeyboard()
|
RADAR:ToggleFullKeyboard()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Shortcut to restart the resource
|
|
||||||
--[[ if ( IsDisabledControlJustPressed( 1, 167 ) ) then
|
|
||||||
ExecuteCommand( "restart wk_wars2x" )
|
|
||||||
end ]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Control manager
|
-- Control manager
|
||||||
|
|||||||
29
cl_utils.lua
29
cl_utils.lua
@@ -1,9 +1,34 @@
|
|||||||
--[[-----------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
-----------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
UTIL = {}
|
UTIL = {}
|
||||||
|
|
||||||
|
|||||||
46
config.lua
46
config.lua
@@ -1,9 +1,34 @@
|
|||||||
--[[------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
------------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
-- Do not touch this
|
-- Do not touch this
|
||||||
CONFIG = {}
|
CONFIG = {}
|
||||||
@@ -96,3 +121,20 @@ CONFIG.menuDefaults =
|
|||||||
-- Options: mph or kmh
|
-- Options: mph or kmh
|
||||||
["speedType"] = "mph"
|
["speedType"] = "mph"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Here you can change the default scale of the UI elements, as well as the safezone size
|
||||||
|
CONFIG.uiDefaults =
|
||||||
|
{
|
||||||
|
-- The default scale of the UI elements.
|
||||||
|
-- Options: 0.25 - 2.5
|
||||||
|
scale =
|
||||||
|
{
|
||||||
|
radar = 1.5,
|
||||||
|
remote = 1.5,
|
||||||
|
plateReader = 1.5
|
||||||
|
},
|
||||||
|
|
||||||
|
-- The safezone size, must be a multiple of 5.
|
||||||
|
-- Options: 0 - 100
|
||||||
|
safezone = 20
|
||||||
|
}
|
||||||
@@ -1,9 +1,34 @@
|
|||||||
--[[-----------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
-----------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
-- Define the FX Server version and game type
|
-- Define the FX Server version and game type
|
||||||
fx_version "adamant"
|
fx_version "adamant"
|
||||||
@@ -13,7 +38,7 @@ game "gta5"
|
|||||||
name "Wraith ARS 2X"
|
name "Wraith ARS 2X"
|
||||||
description "Police radar and plate reader system for FiveM"
|
description "Police radar and plate reader system for FiveM"
|
||||||
author "WolfKnight"
|
author "WolfKnight"
|
||||||
version "pre-release"
|
version "1.0.0"
|
||||||
|
|
||||||
-- Include the files
|
-- Include the files
|
||||||
files {
|
files {
|
||||||
@@ -34,6 +59,8 @@ ui_page "nui/radar.html"
|
|||||||
-- Run the server scripts
|
-- Run the server scripts
|
||||||
server_script "sv_version_check.lua"
|
server_script "sv_version_check.lua"
|
||||||
server_script "sv_saving.lua"
|
server_script "sv_saving.lua"
|
||||||
|
server_script "sv_exports.lua"
|
||||||
|
server_export "TogglePlateLock"
|
||||||
|
|
||||||
-- Run the client scripts
|
-- Run the client scripts
|
||||||
client_script "config.lua"
|
client_script "config.lua"
|
||||||
|
|||||||
@@ -1,3 +1,35 @@
|
|||||||
|
/*-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Wraith ARS 2X
|
||||||
|
Created by WolfKnight
|
||||||
|
|
||||||
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Seg-7";
|
font-family: "Seg-7";
|
||||||
src: url( "fonts/Segment7Standard.otf" );
|
src: url( "fonts/Segment7Standard.otf" );
|
||||||
@@ -247,7 +279,10 @@ button:focus { outline: none; }
|
|||||||
border: 2px solid rgb( 0, 0, 0 );
|
border: 2px solid rgb( 0, 0, 0 );
|
||||||
|
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
|
|
||||||
|
/* If you would like your strong target window to be solid rather than have a gradient, swap the comment for the 2 lines below */
|
||||||
background-color: rgb( 61, 18, 0 );
|
background-color: rgb( 61, 18, 0 );
|
||||||
|
/* background: linear-gradient( to bottom, rgb( 52, 13, 1 ), rgb( 57, 16, 0 ) 40%, rgb( 65, 25, 4 ) 85% ); */
|
||||||
}
|
}
|
||||||
#radar .speeds_container .display p {
|
#radar .speeds_container .display p {
|
||||||
grid-row-start: 1;
|
grid-row-start: 1;
|
||||||
@@ -266,7 +301,10 @@ button:focus { outline: none; }
|
|||||||
|
|
||||||
#radar .speeds_container .fast {
|
#radar .speeds_container .fast {
|
||||||
height: 60px;
|
height: 60px;
|
||||||
|
|
||||||
|
/* If you would like your fast target window to be solid rather than have a gradient, swap the comment for the 2 lines below */
|
||||||
background-color: rgb( 50, 0, 0 );
|
background-color: rgb( 50, 0, 0 );
|
||||||
|
/* background: linear-gradient( to bottom, rgb( 40, 0, 0 ), rgb( 45, 0, 0 ) 40%, rgb( 50, 0, 0 ) 85% ); */
|
||||||
}
|
}
|
||||||
#radar .speeds_container .fast p {
|
#radar .speeds_container .fast p {
|
||||||
font-size: 60px;
|
font-size: 60px;
|
||||||
@@ -326,6 +364,7 @@ button:focus { outline: none; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
#radar .patrol_and_logo_container .display {
|
#radar .patrol_and_logo_container .display {
|
||||||
|
/* If you would like your patrol speed window to be solid rather than have a gradient, swap the comment for the 2 lines below */
|
||||||
background-color: rgb( 0, 57, 35 );
|
background-color: rgb( 0, 57, 35 );
|
||||||
/* background: linear-gradient( to bottom, rgb( 0, 40, 29 ), rgb( 0, 46, 32 ) 40%, rgb( 1, 64, 27 ) 85% ); */
|
/* background: linear-gradient( to bottom, rgb( 0, 40, 29 ), rgb( 0, 46, 32 ) 40%, rgb( 1, 64, 27 ) 85% ); */
|
||||||
}
|
}
|
||||||
@@ -820,7 +859,7 @@ button:focus { outline: none; }
|
|||||||
|
|
||||||
#uiSettingsBox {
|
#uiSettingsBox {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
height: 375px;
|
height: 400px;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|||||||
@@ -1,3 +1,35 @@
|
|||||||
|
<!-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Wraith ARS 2X
|
||||||
|
Created by WolfKnight
|
||||||
|
|
||||||
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
@@ -275,7 +307,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Load JavaScript files -->
|
<!-- Load JavaScript files -->
|
||||||
<!-- <script src="nui://game/ui/jquery.js"></script> -->
|
|
||||||
<script src="jquery-3.4.1.min.js"></script>
|
<script src="jquery-3.4.1.min.js"></script>
|
||||||
<script src="radar.js"></script>
|
<script src="radar.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
76
nui/radar.js
76
nui/radar.js
@@ -1,12 +1,34 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
This JS file takes inspiration from RandomSean's RS9000 JS file, so
|
For discussions, information on future updates, and more, join
|
||||||
thanks to him!
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
-------------------------------------------------------------------------*/
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------------
|
||||||
Variables
|
Variables
|
||||||
@@ -644,26 +666,55 @@ function sendSaveData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loads the UI settings
|
// Loads the UI settings
|
||||||
function loadUiSettings( data )
|
function loadUiSettings( data, isSave )
|
||||||
{
|
{
|
||||||
// Iterate through "remote", "radar" and "plateReader"
|
// Iterate through "remote", "radar" and "plateReader"
|
||||||
for ( let setting of [ "remote", "radar", "plateReader" ] )
|
for ( let setting of [ "remote", "radar", "plateReader" ] )
|
||||||
{
|
{
|
||||||
|
let ele = elements[setting];
|
||||||
|
|
||||||
|
if ( isSave ) {
|
||||||
// Iterate through the settings
|
// Iterate through the settings
|
||||||
for ( let i of [ "left", "top" ] )
|
for ( let i of [ "left", "top" ] )
|
||||||
{
|
{
|
||||||
// Update the position of the current element
|
// Update the position of the current element
|
||||||
elements[setting].css( i, data[setting][i] );
|
ele.css( i, data[setting][i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the scale and update the display
|
// Set the scale and update the display
|
||||||
setScaleAndDisplay( elements[setting], data[setting].scale, elements[setting + "Scaling"].display );
|
setScaleAndDisplay( ele, data[setting].scale, elements[setting + "Scaling"].display );
|
||||||
|
} else {
|
||||||
|
// Set the scale and update the display
|
||||||
|
setScaleAndDisplay( ele, data.scale[setting], elements[setting + "Scaling"].display );
|
||||||
|
|
||||||
|
// Get the scaled width and height of the current element
|
||||||
|
let w = ( ele.outerWidth() * data.scale[setting] );
|
||||||
|
let h = ( ele.outerHeight() * data.scale[setting] );
|
||||||
|
|
||||||
|
// The position of the element then needs to be updated.
|
||||||
|
switch ( setting ) {
|
||||||
|
case "remote":
|
||||||
|
ele.css( "left", "calc( 50% - " + w / 2 + "px )" );
|
||||||
|
ele.css( "top", "calc( 50% - " + h / 2 + "px )" );
|
||||||
|
break;
|
||||||
|
case "radar":
|
||||||
|
ele.css( "left", "calc( ( 100% - " + data.safezone + "px ) - " + w + "px )" );
|
||||||
|
ele.css( "top", "calc( ( 100% - " + data.safezone + "px ) - " + h + "px )" );
|
||||||
|
break;
|
||||||
|
case "plateReader":
|
||||||
|
ele.css( "left", "calc( ( 100% - " + data.safezone + "px ) - " + w + "px )" );
|
||||||
|
ele.css( "top", "calc( 50% - " + h / 2 + "px )" );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the remote, radar and reader scale variables
|
// Update the remote, radar and reader scale variables
|
||||||
remoteScale = data.remote.scale;
|
remoteScale = isSave ? data.remote.scale : data.scale.remote;
|
||||||
radarScale = data.radar.scale;
|
radarScale = isSave ? data.radar.scale : data.scale.radar;
|
||||||
readerScale = data.plateReader.scale;
|
readerScale = isSave ? data.plateReader.scale : data.scale.plateReader;
|
||||||
|
|
||||||
// Set the safezone and update the display
|
// Set the safezone and update the display
|
||||||
elements.safezoneSlider.val( data.safezone );
|
elements.safezoneSlider.val( data.safezone );
|
||||||
@@ -1002,7 +1053,10 @@ window.addEventListener( "message", function( event ) {
|
|||||||
resourceName = item.pathName
|
resourceName = item.pathName
|
||||||
break;
|
break;
|
||||||
case "loadUiSettings":
|
case "loadUiSettings":
|
||||||
loadUiSettings( item.data );
|
loadUiSettings( item.data, true );
|
||||||
|
break;
|
||||||
|
case "setUiDefaults":
|
||||||
|
loadUiSettings( item.data, false );
|
||||||
break;
|
break;
|
||||||
case "displayKeyLock":
|
case "displayKeyLock":
|
||||||
displayKeyLock( item.state );
|
displayKeyLock( item.state );
|
||||||
|
|||||||
50
sv_exports.lua
Normal file
50
sv_exports.lua
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Wraith ARS 2X
|
||||||
|
Created by WolfKnight
|
||||||
|
|
||||||
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
|
-- Although there is only one export at the moment, more may be added down the line.
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
Locks the designated plate reader camera for the given client.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
clientId:
|
||||||
|
The id of the client
|
||||||
|
cam:
|
||||||
|
The camera to lock, either "front" or "rear"
|
||||||
|
beepAudio:
|
||||||
|
Play an audible beep, either true or false
|
||||||
|
boloAudio:
|
||||||
|
Play the bolo lock sound, either true or false
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
function TogglePlateLock( clientId, cam, beepAudio, boloAudio )
|
||||||
|
TriggerClientEvent( "wk:togglePlateLock", clientId, cam, beepAudio, boloAudio )
|
||||||
|
end
|
||||||
@@ -1,9 +1,34 @@
|
|||||||
--[[-----------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
-----------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
local DATASAVE = {}
|
local DATASAVE = {}
|
||||||
DATASAVE.dir = "saves"
|
DATASAVE.dir = "saves"
|
||||||
@@ -19,6 +44,9 @@ DATASAVE.dir = "saves"
|
|||||||
-- - ip
|
-- - ip
|
||||||
DATASAVE.idType = "license"
|
DATASAVE.idType = "license"
|
||||||
|
|
||||||
|
-- Whether or not to print messages
|
||||||
|
DATASAVE.printMessages = true
|
||||||
|
|
||||||
-- Saves the data for the given player into the saves folder within the resource
|
-- Saves the data for the given player into the saves folder within the resource
|
||||||
function DATASAVE:SavePlayerData( src, data )
|
function DATASAVE:SavePlayerData( src, data )
|
||||||
-- Get the player's identifier
|
-- Get the player's identifier
|
||||||
@@ -115,7 +143,9 @@ end
|
|||||||
|
|
||||||
-- Prints the given message with the resource name attached
|
-- Prints the given message with the resource name attached
|
||||||
function DATASAVE:Print( msg )
|
function DATASAVE:Print( msg )
|
||||||
|
if ( self.printMessages ) then
|
||||||
print( "^3[wk_wars2x] ^0" .. msg .. "^0" )
|
print( "^3[wk_wars2x] ^0" .. msg .. "^0" )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Serverside event for saving a player's UI data
|
-- Serverside event for saving a player's UI data
|
||||||
@@ -146,5 +176,8 @@ AddEventHandler( "wk:getUiData", function()
|
|||||||
else
|
else
|
||||||
-- When player's first use the radar, they won't have saved UI data
|
-- When player's first use the radar, they won't have saved UI data
|
||||||
DATASAVE:Print( "Player " .. GetPlayerName( source ) .. " (ID: " .. source .. ") doesn't have a UI settings file." )
|
DATASAVE:Print( "Player " .. GetPlayerName( source ) .. " (ID: " .. source .. ") doesn't have a UI settings file." )
|
||||||
|
|
||||||
|
-- Tell the system to load the UI defaults for the client
|
||||||
|
TriggerClientEvent( "wk:setUiDefaults", source )
|
||||||
end
|
end
|
||||||
end )
|
end )
|
||||||
@@ -1,9 +1,34 @@
|
|||||||
--[[-----------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
Wraith ARS 2X
|
Wraith ARS 2X
|
||||||
Created by WolfKnight
|
Created by WolfKnight
|
||||||
|
|
||||||
-----------------------------------------------------------------------]]--
|
For discussions, information on future updates, and more, join
|
||||||
|
my Discord: https://discord.gg/fD4e6WD
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 WolfKnight
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
-- Branding!
|
-- Branding!
|
||||||
local label =
|
local label =
|
||||||
@@ -15,6 +40,8 @@ local label =
|
|||||||
|| \ \/ \/ / '__/ _` | | __| '_ \ / /\ \ | _ / \___ \ / / > <
|
|| \ \/ \/ / '__/ _` | | __| '_ \ / /\ \ | _ / \___ \ / / > <
|
||||||
|| \ /\ /| | | (_| | | |_| | | | / ____ \| | \ \ ____) | / /_ / . \
|
|| \ /\ /| | | (_| | | |_| | | | / ____ \| | \ \ ____) | / /_ / . \
|
||||||
|| \/ \/ |_| \__,_|_|\__|_| |_| /_/ \_\_| \_\_____/ |____/_/ \_\
|
|| \/ \/ |_| \__,_|_|\__|_| |_| /_/ \_\_| \_\_____/ |____/_/ \_\
|
||||||
|
||
|
||||||
|
|| Created by WolfKnight
|
||||||
||]]
|
||]]
|
||||||
|
|
||||||
-- Returns the current version set in fxmanifest.lua
|
-- Returns the current version set in fxmanifest.lua
|
||||||
|
|||||||
Reference in New Issue
Block a user