🤢 K_Diseases | Diseases/Illnesses/Sick/Medicine

Hello again FiveMers :wave:

Ever wanted your server to include some diseases? :nauseated_face:

Well i think this might help you out :slight_smile:


Add an endless amount of diseases to you server (granted you will need to add ways to get them) and watch your players suffer and have much better medical rp!

Simulate all types of diseases like COVID-19 or The Plague or even some common sicknesses like The Flu!

Whats’ included?

:diamonds: A simple system to manage as many diseases as you want!
:diamonds: Add ways for your players to get sick
:diamonds: Players can spread diseases between each other!
:diamonds: Have new medicines in your server!
:diamonds: Synced sounds so players can hear others
:diamonds: Give medical roleplay a new way to play!
:zap: Resmon: 0.00-0.01

Support for STD’s for my other script: :underage: SexV | FiveM Sex/Sleep/Pregnancy Script 18+ [QBcore/ESX/Standalone]

Support for extended diseases in :poop: HygieneV | Pee/Poop/Shower/Bath/Porta Pottie

Video Showcase
give me a little subscribe on there pretty please :pleading_face:


This script is aimed at developers with an understanding on how triggerevents/exports work as you will need to know how to add them to what ever you want a player to get a disease from.

A basic system is shown in the config.lua on how you could do this/add to it!

Docs, This script does require a very basic understanding of lua/events

CatchDisease(type, chance, checkifalreadyhasit):

exports['k_diseases']:CatchDisease(type, chance, checkifalreadyhasit)
TriggerEvent('k_diseases:catchdisease', type, chance, checkifalreadyhasit)

This can be used to give a player a specified disease, example:
exports['k_diseases']:CatchDisease("Common Cold", 100, false)


ClearDisease(type):

exports['k_diseases']:ClearDisease(type)
TriggerEvent('k_diseases:cleardisease', type)

This can be used to remove a player a specified disease example:
exports['k_diseases']:ClearDisease("Common Cold")


GetDiseases():

exports['k_diseases']:GetDiseases()

This is used to return all a players diseases
exports['k_diseases']:GetDiseases()['Common Cold'].hasDiseases


ClearAllDisease():

exports['k_diseases']:ClearAllDisease()
TriggerEvent('k_diseases:clearall')

Removes all a specified player’s current diseases
exports['k_diseases']:ClearAllDisease()

Config
Config = {}
Config.Variables = {
    Framework = 'QB', -- QB/ESX/None -- set to none to use k_diseases:forceStart trigger instead
    Notify = 'QB', -- QB/ESX/Custom -- custom function below
    ESXSharedObject = 'esx:getSharedObject', -- leave as is for qb(it wont be used)
    SearchForDiseasesTime = 1, -- in mins 0.5 = 30 secs, 1 = 1min, 10 = 10min
    Cooldown = 0.5, -- in mins 0.5 = 30 secs, 1 = 1min, 10 = 10min
    CycleTime = 5000, -- in MS, 5000 = 5 secs (time between disease effects)
    useBuiltInSearch = true, -- Use sickness inducers from the function  Search() at line 366
    UseCommands = false, -- Enable /useMed  exmaple: (/useMed tylenol)
    Debug = false, -- Enable  /sickness (for restarting the script to test) /getS Use to give yourself a disease (/getS "Common Cold") /removeS removes a disease (/removeS "Common Cold") /removeAllS removes all diseases
}


--[[
    TriggerEvent('k_diseases:getPlayerSicknes') -- you can add this to a radial menu or a command to disable a nearby players diseases
]]

-- This system works with SexV you can get it here! https://kbase.tebex.io/
--** NOTE WHEN CHANGING/ADDING NEW DISEASES YOU WILL HAVE TO REMOVE/WIPE SICKNESS DATA FROM DB**--
Config.Diseases = {
    ['Common Cold'] = {
        hasDiseases = false,
        iterations = 15,
    },

    ['Bad Stomach'] = {
        hasDiseases = false,
        iterations = 15,
    },

    ['Diarrhea'] = {
        hasDiseases = false,
        iterations = 10,
        chance = 50
    },

    ['Headache'] = {
        hasDiseases = false,
        iterations = 10,
    },

    ['Dizzy'] = {
        hasDiseases = false,
        iterations = 10,
    },

    ['Covid'] = {
        hasDiseases = false,
        iterations = 100,
    },

    -------Only if using SexV---------
    ['Chlamydia'] = {
        hasDiseases = false,
        iterations = 10,
    },
    ['Gonorrhea'] = {
        hasDiseases = false,
        iterations = 10,
    },
    ['Herpes'] = {
        hasDiseases = false,
        iterations = 10,
    }
}


--[[ ##EXAMPLE Disease YOU WILL NEED TO WIPE player_sickness AFTER ADDING NEW DISEASES

    ['Scary'] = {
        hasDiseases = false,
        iterations = 10, 
    }

    ['Scary'] = {
        animation = {dict = "missprologueig_5@cough", anim = "walk", time = 2000}, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured) 
        catchNotify = "You caught a Common Cold",  -- or false
        notify = false, -- Everytime effects happen
        spreadData = {range = 2.0, chance=50}, -- Chance to spread in % (50 = 50%, 100 = 100%)
        sound = {
            male = 'sneeze', female = 'sneezefemale', range = 3.0, volume = 0.5, sourceonly = false
        }, -- or false
        medication = {
            'tylenol',
        }, -- or false
        Effects = { -- Effects in MS
            hurt = {damage = 5}, -- or false
            blur = {transitionIn = 1000, transitionOut = 1000}, -- set to blur = false to disable blur
            screenEffect = {effectName="DanceIntensity03", duration=5000}, --or false
            ragdoll = {time = 1000}, -- or false
            sickpfx = true, -- or false
            affectDriving = {time = 10}, -- or false
        }
    },
]]

Config.SicknessEffects = { -- times should be should be less than CycleTime
    ['Common Cold'] = {
        animation = {dict = "missprologueig_5@cough", anim = "walk", time = 2000}, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured) 
        catchNotify = "You caught a Common Cold",
        notify = false, -- Everytime effects happen
        spreadData = {range = 2.0, chance=75}, -- Chance to spread in % (50 = 50%, 100 = 100%)
        sound = {
            male = 'sneeze', female = 'sneezefemale', range = 4.0, volume = 0.5, sourceonly = false
        },
        medication = {
            'tylenol',
        },
        Effects = { -- Effects in MS
            hurt = false , --{damage = 5}
            blur = {transitionIn = 1000, transitionOut = 1000}, -- set to blur = false to disable blur
            screenEffect = false,
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = {time = 10}, 
        }
    },

    ['Bad Stomach'] = {
        animation = {dict = "missexile3", anim = "ex03_train_roof_idle", time = 5000}, --set animation = false for no anim
        walk = {style = "MOVE_M@DRUNK@VERYDRUNK", time=10000}, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = false,
        sound = false,
        spreadData = {range = 1.2, chance=25},
        medication = {
            'peptobismol',
        },
        Effects = { -- Effects are in ms, 1000 = 1 sec
            hurt = {damage = 1} , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = false,
            ragdoll = false, -- {time = 1000}
            sickpfx = true,
            affectDriving = false,
        }
    },

    ['Diarrhea'] = {
        animation = {dict = "missfbi3ig_0", anim = "shit_loop_trev", time = 5000}, --set animation = false for no anim
        walk = {style = "MOVE_M@DRUNK@VERYDRUNK", time=5000}, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = 'You almost shit yourself.',
        sound = false,
        spreadData = false,
        spreadData = {range = 1.2, chance=25},
        medication = {
            'loperamide',
        },
        Effects = { -- Effects are in ms, 1000 = 1 sec
            hurt = {damage = 1} , --{damage = 5}
            screenEffect = false,
            blur = false, -- set to blur = false to disable blur
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },

    ['Headache'] = {
        animation = false, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = false,
        sound = false,
        spreadData = false,
        medication = {
            'aspirin',
            'ibuprofen',  
        },
        Effects = { -- Effects in MS
            hurt = false , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = {effectName="DanceIntensity03", duration=5000},
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },

    ['Dizzy'] = {
        animation = false, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = "You begin to feel dizzy",
        notify = false,
        sound = false,
        spreadData = false,
        medication = {
            'dramamine',
        },
        Effects = { -- Effects in MS
            hurt = false , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = {effectName="DrugsDrivingOut", duration=5000},
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },

    ['Covid'] = {
        animation = {dict = "timetable@gardener@smoking_joint", anim = "idle_cough", time = 2000}, --set animation = false for no anim
        walk = {style = "MOVE_M@DRUNK@VERYDRUNK", time=1000}, --set walk = false for no walk, set time to false for infinite
        deplete = true, -- Depletes from set iterations (once iterations are done the player gets cured)
        spreadData = {range = 2.0, chance=90},
        notify = 'It hurt\'s to breath',
        catchNotify = "You caught Covid",
        sound = {male = 'cough', female = 'coughfemale', range = 4.0, volume = 0.5, sourceonly = false},
        medication = {
            'covidvaccine',
        },
        Effects = { -- Effects in MS
            hurt = {damage = 4}, --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = false,
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },

    -------Only if using SexV you can get it here https://kbase.tebex.io/ ---------
    ['Chlamydia'] = {
        animation = false, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite

        deplete = false, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = false,
        sound = false,
        spreadData = false,
        medication = {
            'doxycycline',
            'azithromycin'
        },
        Effects = { -- Effects in MS
            hurt = {damage = 2} , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = {effectName="CarDamageHit", duration=1000},
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },
    ['Gonorrhea'] = {
        animation = false, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = false, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = false,
        sound = false,
        spreadData = false,
        medication = {
            'azithromycin',
        },
        Effects = { -- Effects in MS
            hurt = {damage = 2} , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = {effectName="CarDamageHit", duration=1000},
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    },
    ['Herpes'] = { 
        animation = false, --set animation = false for no anim
        walk = false, --set walk = false for no walk, set time to false for infinite
        deplete = false, -- Depletes from set iterations (once iterations are done the player gets cured)
        catchNotify = false,
        notify = false,
        sound = false,
        spreadData = false,
        medication = {
            'acyclovir',
        },
        Effects = { -- Effects in MS
            hurt = {damage = 2} , --{damage = 5}
            blur = false, -- set to blur = false to disable blur
            screenEffect = {effectName="CarDamageHit", duration=1000},
            ragdoll = false, -- {time = 1000}
            sickpfx = false,
            affectDriving = false,
        }
    }
    -------Only if using SexV you can get it here https://kbase.tebex.io/ ---------
}


Config.Medication = {
    'tylenol',
    'peptobismol',
    'loperamide',
    'aspirin',
    'ibuprofen', 
    'dramamine',
    'covidvaccine',
    'doxycycline',
    'azithromycin',
    'acyclovir',
}




if not IsDuplicityVersion() then --Client Side
    function Notify(text, type)
        print(text)
        --custom code for a custom notify
    end

    function OnEffect(type)
        --print(type)
    end

    function CanPedDoAnim()
        if K.CheckDead() then
            return false
        end
        return true
    end

    RegisterCommand('getPlayerSickness', function()
        local closestPlayer, closestDistance, closestPlayerPed = K.GetClosestPlayer()
        if closestDistance < 2.0 then
            TriggerServerEvent("k_diseases:getSicknessFromPlayer", closestPlayer) 
        else
            K.NotifyFramework('No one nearby.', 'error')
        end
    end)
    

    function CanBeInfectedByOthers() -- This calls for a return on a percent (25 = 25% chance to be infected, 100 = 100% chance to be infected)
        local hasMask, maskId = K.IsPlayerWearingMask() -- gets the player and if they are wearing a mask
        --[[ Example on how you could setup certain masks to have certain resistance 
            if maskId == 5 then
                return 0 -- plauyer will have 0 chance to get infected
            end
        
        ]]

        if hasMask then
            return 5 -- if the player is wearing a mask they have an increased tolerance to getting infected by others (5% chance of getting infected)
        end
        
        return 100 -- 100 means they have no protection
    end

    function CanInfectOthers() -- This calls for a return on a percent (25 = 25% chance to infect other players, 100 = 100% chance to infect other players)
        local hasMask, maskId = K.IsPlayerWearingMask() -- gets the player and if they are wearing a mask

        --[[ Example on how you could setup certain masks to have certain resistance 
            if maskId == 5 then
                return 0 -- plauyer will have 0 chance to infect others
            end
        
        ]]

        if hasMask then
            return 5 -- 25 means the player has a 25% chance to infect other players if they have a mask  (this wont effect spreadData this is just a 2nd check for masks) 
        end
        
        return 100 -- 100 means they will always infect other players (this wont effect spreadData this is just a 2nd check for masks) 
    end

    function Search() -- Example on how the player could get a illness. 


        if GetRainLevel() >= 0.3  then -- best way i could find to simulate a cold method
            exports['k_diseases']:CatchDisease("Common Cold", 25, true)  --  exports['k_diseases']:CatchDisease(TYPE, CHANCE, CHECKIFALREADYHASIT)
            exports['k_diseases']:CatchDisease("Covid", 5, true)
            exports['k_diseases']:CatchDisease("Headache", 25, true)
        end

    end
    

else
    function DropExploiter(src)
        DropPlayer(src, 'stinky cheetor')
    end
end


function GetCore()
    if not IsDuplicityVersion() then -- Client side
        if Config.Variables.Framework == 'QB' then
            return exports['qb-core']:GetCoreObject()
        elseif Config.Variables.Framework == 'ESX' then
            local ESX = nil
            Citizen.CreateThread(function()
                while ESX == nil do
                    TriggerEvent(Config.Variables.ESXSharedObject, function(obj) return obj end)
                    Wait(0)
                end
            end)
        end

    else -- Server side
        print('^3Thanks for using my script :) Need assistance support at ^5hidden ^7')
        if Config.Variables.Framework == 'QB' then
            return exports['qb-core']:GetCoreObject()
        elseif Config.Variables.Framework == 'ESX' then
            local ESX = nil
            TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
            return ESX
        end
    end
    return false
end

You can get the script here:
Buy K_DISEASES

Code is accessible No, Good amount of config see Docs ^
Subscription-based No, although subscription tier is available
Lines (approximately) 1020
Requirements oxmysql, interact-sound
Support Yes
12 Likes

this is pretty cool, would it be possible to add vacinations which lower your chance of getting that certain sickness

Yeah, It should be possible, you can create your own way combined with this script to achieve that :slight_smile:

i might even add some extra support to help that stuff in the future :slight_smile:

3 Likes

sweet and it’s possible to choose how often diseases can happen?

Yes you have full control of when diseases can happen, for custom diseases you will need to provide a way to gain the disease :slight_smile:

1 Like

sweet i have purchased :slightly_smiling_face:

1 Like

Cfx needs to create a vaccine script and force people to get it, even if they don’t have the disease script. I mean, if governments can do it, why can’t they???

LOL, sorry… Bad joke.

1 Like

accurate lol

Does standalone take any extensive setup to make work?

Nope, Just one config switch and to run a sql file and thats pretty much it :slight_smile:
Then your able to setup diseases in your server were ever you feel like!

Also you would need to install the interact-sound if you want sounds :slight_smile:

2 Likes

Just bought :slight_smile:

Do you have plans for ox_inventory support in future as well?

It should support it already friend :slight_smile:

1 Like

you going to add STDs to go with you over script lolol

Can I modify the catchNotify or only the notify?

both :slight_smile:

1 Like
if not IsDuplicityVersion() then --Client Side
    function Notify(text, type)
        exports['t-notify']:Custom({
			style = 'sick',
			duration = 2000,
			message = text,		
			sound = false,
			custom = true
		})
		end
    end

this should work for both types?

Yes that should work :slight_smile:

Great job, my friend! This looks truly unique. I haven’t roleplayed in a while, but I’d love to see this on a server.

2 Likes

I love it so far!

Couple of Suggestions!

  1. One suggestion would be to be able to change the /useMed command if possible! <3
  2. Another suggestion is addition of stumble effect so you dont fall right over like Ragdoll

Could you elaborate on these settings:
• SearchForDiseasesTime
• Cooldown

  • Is SearchForDiseasesTime the amount of time to find a contagious person nearby or rather the amount of time you need to spend close to someone who is sick to be able to get sick yourself?

  • Cooldown the amount of time between being sick and then getting sick again? Can it be higher than 10 minutes or was that just the example?

Time till Search() is executed (the basic disease search in config.lua)

This is for diseases to trigger the effects (like a cycle every 60secs once it starts each effect will play after CycleTime)

Also yes you should be able to put in any time at Cooldown :slight_smile:

Yes, Great suggestions i will add more config options soon!

Hope this helps :slight_smile:

1 Like