Skip to content

Commit

Permalink
Add new debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
AllRoundJonU committed Sep 5, 2024
1 parent ae7d861 commit fede2f2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions client/cl_using.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local setDrugEffects = function(effects)
local ped = PlayerPedId()
for _, effect in pairs(effects) do

if drugEffects[effect] == nil then return end
if drugEffects[effect] == nil then if Config.Debug then lib.print.error('[setDrugEffects] | unable to find effect', effect) end return end
drugEffects[effect] = true

if effect == "runningSpeedIncrease" then
Expand Down Expand Up @@ -261,19 +261,22 @@ RegisterNetEvent('it-drugs:client:takeDrug', function(drugItem)
local drugData = Config.Drugs[drugItem]
local ped = PlayerPedId()

if drugData == nil then
ShowNotification(nil, _U('NOTIFICATION__DRUG__NO__EFFECT'), "error")
return
end

lib.print.info('[takeDrug] | Drug Data:', drugData)
if cooldowns[drugItem] ~= nil then
local time = GetGameTimer()
if time > cooldowns[drugItem] then
cooldowns[drugItem] = time + drugData.cooldown * 1000 + drugData.time * 1000
else
ShowNotification(nil, _U('NOTIFICATION__DRUG__COOLDOWN'), "info")
return
end
else
cooldowns[drugItem] = GetGameTimer() + (drugData.cooldown * 1000 + (drugData.time * 1000))
lib.print.info('Cooldowns:', cooldowns)
end

if drugData == nil then
ShowNotification(nil, _U('NOTIFICATION__DRUG__NO__EFFECT'), "error")
return
end

currentDrug = drugItem
Expand All @@ -288,8 +291,8 @@ RegisterNetEvent('it-drugs:client:takeDrug', function(drugItem)
loadAnimDict('amb@world_human_smoking_pot@female@base')
TaskPlayAnim(ped, 'amb@world_human_smoking_pot@female@base', 'base', 3.0, 3.0, 3000, 48, 0, false, false, false)
end

setDrugEffects(drugData.effects)

SetTimeout(drugData.time * 1000, clearDrugEffects)
end)

Expand Down

0 comments on commit fede2f2

Please sign in to comment.