Malaria Script
Overview
This script implements a malaria disease system in RSG, allowing players to contract, spread, and cure malaria. The system includes location-based infection zones, player-to-player transmission, and treatment mechanics.
Core Features
- Malaria infection through designated zones
- Player-to-player disease transmission
- Visual symptoms including vomiting animations
- Health deterioration system
- Curable through medicine
- Special infection through mysterious boxes
- Protection for law enforcement and medical personnel
Dependencies
- RSG-Core framework
- rsg-inventory
- ox_lib (for progress bars)
- rNotify (for notifications)
Items Required
malaria_medicine- Used to cure malariaoldbox- Can infect players with malaria when opened
Database Integration
The script uses the RSG-Core player metadata system. The malaria state is synced between clients but doesn't appear to permanently save to the database, meaning players will reset their malaria status upon server restart.
Configuration Options
Health Management
Healthtake: Amount of health removed per tick (default: 50)MinHealthLimit: Minimum health level (default: 0)MaxHealthDrain: Maximum health drain limit (default: 600)CureHealthRestore: Health restored when cured (default: 600)
Timing Controls
SicktickMin: Minimum time between sickness episodes (default: 45000ms)SicktickMax: Maximum time between sickness episodes (default: 60000ms)HealthTickRate: Rate of health checks (default: 1000ms)CureTime: Time taken to use medicine (default: 4000ms)
Disease Mechanics
chanceToRagdoll: Probability of ragdoll effect (default: 70%)MalariaSpread: Toggle disease transmission (default: true)SpreadDistance: Maximum distance for transmission (default: 4.0 units)SpreadChance: Probability of transmission (default: 100%)
Infection Zones
Configurable locations where players can contract malaria:
luaCopyInfectionLocations = {
{
coords = vector3(x, y, z),
radius = 10.0, // Detection radius
chance = 50 // Infection probability
}
}Usage Instructions
For Players
- Players can contract malaria by:
- Entering infection zones
- Being near infected players
- Opening mysterious boxes
- Symptoms include:
- Periodic vomiting animations
- Health deterioration
- Random ragdoll effects
- Treatment:
- Use malaria medicine to cure the condition
- Health will be restored to the configured level
- Protection for law enforcement and medical personnel
For Administrators
- Item Setup:
- Add
malaria_medicineandoldboxto your items database - Configure item properties in RSG-Core shared items
- Add
- Configuration:
- Adjust health values based on your server's health system
- Modify infection zones to match your map
- Balance spread mechanics for your server population
- Debug Mode:
- Set
Debug = truefor detailed console logging - Monitor spread attempts and infection events
- Set
Technical Notes
- The script includes safeguards against exploitation
- Server-side distance checking for disease transmission
- Protected professions (LEO and Medical) cannot contract malaria
- Animation dictionaries are properly loaded and unloaded
- Includes state management for inventory access during animations