mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Block key binds from being registered if the resource name is not wk_wars2x
This commit is contained in:
@@ -44,6 +44,7 @@ local pairs = pairs
|
|||||||
Key bind registering
|
Key bind registering
|
||||||
----------------------------------------------------------------------------------]]--
|
----------------------------------------------------------------------------------]]--
|
||||||
local function RegisterKeyBinds()
|
local function RegisterKeyBinds()
|
||||||
|
if ( UTIL:IsResourceNameValid() ) then
|
||||||
UTIL:Log( "Registering radar commands and key binds." )
|
UTIL:Log( "Registering radar commands and key binds." )
|
||||||
|
|
||||||
-- Opens the remote control
|
-- Opens the remote control
|
||||||
@@ -98,6 +99,9 @@ local function RegisterKeyBinds()
|
|||||||
DeleteResourceKvp( "wk_wars2x_om_data" )
|
DeleteResourceKvp( "wk_wars2x_om_data" )
|
||||||
DeleteResourceKvp( "wk_wars2x_new_user" )
|
DeleteResourceKvp( "wk_wars2x_new_user" )
|
||||||
end, false )
|
end, false )
|
||||||
|
else
|
||||||
|
UTIL:Log( "ERROR: Resource name is not wk_wars2x. Key binds will not be registered for compatibility reasons. Contact the server owner and ask them to change the resource name back to wk_wars2x" )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
---------------------------------------------------------------------------------------]]--
|
---------------------------------------------------------------------------------------]]--
|
||||||
|
|
||||||
UTIL = {}
|
UTIL = {}
|
||||||
|
UTIL.resourceName = ""
|
||||||
|
|
||||||
-- Returns a number to a set number of decimal places
|
-- Returns a number to a set number of decimal places
|
||||||
function UTIL:Round( num, numDecimalPlaces )
|
function UTIL:Round( num, numDecimalPlaces )
|
||||||
@@ -136,6 +137,11 @@ function UTIL:DrawDebugText( x, y, scale, centre, text )
|
|||||||
DrawText( x, y )
|
DrawText( x, y )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Citizen.CreateThread( function() UTIL.resourceName = GetCurrentResourceName() end )
|
||||||
|
function UTIL:IsResourceNameValid()
|
||||||
|
return self.resourceName == "wk_wars2x"
|
||||||
|
end
|
||||||
|
|
||||||
--[[The MIT License (MIT)
|
--[[The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2017 IllidanS4
|
Copyright (c) 2017 IllidanS4
|
||||||
|
|||||||
Reference in New Issue
Block a user