@@ -28,11 +28,6 @@ local function SplitStr(inputstr, sep)
2828 return t
2929end
3030
31- function round (number , decimalPlaces )
32- local multiple = 10 ^ (decimalPlaces or 0 )
33- return math.floor (number * multiple + 0.5 ) / multiple
34- end
35-
3631local function connecttoradio (channel )
3732 if channel > Config .MaxFrequency or channel <= 0 then QBCore .Functions .Notify (Lang :t (' restricted_channel_error' ), ' error' ) return false end
3833 if Config .RestrictedChannels [channel ] ~= nil then
160155
161156-- NUI
162157RegisterNUICallback (' joinRadio' , function (data , cb )
163- local rchannel = round (tonumber (data .channel ), 2 )
158+ local rchannel = QBCore . Shared . Round (tonumber (data .channel ), 2 )
164159 if rchannel ~= nil then
165160 if rchannel <= Config .MaxFrequency and rchannel > 0 then
166161 if rchannel ~= RadioChannel then
219214
220215RegisterNUICallback (" increaseradiochannel" , function (_ , cb )
221216 if not onRadio then return end
222- local newChannel = round (tonumber (RadioChannel + 1 ), 2 )
217+ local newChannel = QBCore . Shared . Round (tonumber (RadioChannel + 1 ), 2 )
223218 local canaccess = connecttoradio (newChannel )
224219 cb ({
225220 canaccess = canaccess ,
229224
230225RegisterNUICallback (" decreaseradiochannel" , function (_ , cb )
231226 if not onRadio then return end
232- local newChannel = round (tonumber (RadioChannel - 1 ), 2 )
227+ local newChannel = QBCore . Shared . Round (tonumber (RadioChannel - 1 ), 2 )
233228 local canaccess = connecttoradio (newChannel )
234229 cb ({
235230 canaccess = canaccess ,
0 commit comments