Configuration

nn_drugsale Configuration Guide

This document explains all configuration options available in config.lua and how they are used throughout the nn_drugsale system. Use this as a reference for customizing the script to your server's needs.


General Settings

Config.DialogueCooldown = 1
Config.InteractionDistance = 3.0
Config.OnDutyDuration = 300000
Config.InteractionTimeout = 30
Config.MinPolice = 1
  • DialogueCooldown (number): Cooldown (in seconds) between dialogue interactions.

  • InteractionDistance (number): Distance (in meters) for NPC interactions.

  • OnDutyDuration (number): Duration (in ms) a player stays "on duty" for drug selling.

  • InteractionTimeout (number): Timeout (in seconds) for NPC interaction.

  • MinPolice (number): Minimum police required online to start selling drugs.


Drug Types

Config.Drugs = {
    weed_whitewidow = {
        label = "Weed Baggy",
        image = "weed_baggy.png",
        basePrice = 50,
        minPrice = 40,
        maxPrice = 70,
        amount = 10,
        minAmount = 5,
        maxAmount = 20,
        category = "weed",
        rarity = "common",
        animation = {
            dict = "amb@world_human_smoking@male@male_b@base",
            name = "base",
            duration = 5000,
            scenario = "WORLD_HUMAN_SMOKING"
        }
    },
    -- Add more drugs here
}
  • label: Display name for the drug.

  • image: Inventory image filename.

  • basePrice, minPrice, maxPrice: Pricing for the drug.

  • amount, minAmount, maxAmount: Default and allowed sale amounts.

  • category: Drug category (e.g., "weed", "hard").

  • rarity: Rarity level (e.g., "common").

  • animation: Table with animation dict, name, duration, and scenario for use.

Customization Example:

Config.Drugs['new_drug'] = {
    label = "Super Drug",
    image = "super_drug.png",
    basePrice = 200,
    minPrice = 150,
    maxPrice = 300,
    amount = 5,
    minAmount = 1,
    maxAmount = 10,
    category = "exotic",
    rarity = "rare",
    animation = {
        dict = "mp_player_inteat@burger",
        name = "mp_player_int_eat_burger",
        duration = 5000,
        scenario = "WORLD_HUMAN_AA_SMOKE"
    }
}

Location-Based NPC Type Detection

Config.Locations = {
    -- {x1, y1, x2, y2} = "npc_type"
}
  • Override NPC types in specific map areas by adding coordinates and type.


Notifications

Config.Notifications = {
    onDutyMessage = "You are now on duty for %d minutes",
    offDutyMessage = "You are now off duty",
    expiredMessage = "Your duty status has expired",
    successStyle = "success",
    errorStyle = "error",
    duration = 3000
}
  • Customize notification messages and styles for on/off duty, errors, etc.


Commands

Config.Commands = {
    onDuty = "onduty",
    testDialogue = "test-dialogue",
    endDialogue = "end-dialogue"
}
  • Change the chat commands for on duty, testing dialogue, and ending dialogue.


Phone App Configuration

Config.PhoneApps = {
    dealerApp = true,
    territoriesApp = true,
    goodsApp = true,
    dutyApp = true,
    calculatorApp = true,
    cameraApp = true,
    gamesApp = true
}
  • Enable/disable specific phone apps.


Reputation System

Config.Reputation = {
    minReputation = 0,
    maxReputation = 100,
    changes = {
        declineCounterOffer = -10,
        acceptCounterOffer = 15,
        respondWithin10Minutes = 5,
        respondAfter10Minutes = -8,
        declineOffer = -12,
        successfulDeal = 20,
        noResponse = -15,
        quickDeal = 8,
    },
    responseTimeLimit = 600000
}
  • minReputation, maxReputation: Limits for reputation.

  • changes: How much reputation changes for each action.

  • responseTimeLimit: Time (ms) for response bonuses/penalties.


Drug Test Chance

Config.DrugTestChance = 80
  • Set the chance (percentage) that an NPC will like the drugs.


Gang System

Config.Gangs = {
    detectionMethod = 'qb-gangs',
    customGangDetection = nil,
    gangNames = {
        ballas = "Purple Gang",
        vagos = "Yellow Gang",
        -- ...
    },
    showGangNameInAlerts = true,
    showGangTerritories = true,
    gangJobs = { 'ballas', 'vagos', 'families', 'mafia', 'cartel', 'yakuza', 'bikers', 'triads' }
}
  • detectionMethod: 'qb-gangs', 'qb-gangmenu', 'custom', or 'jobs'.

  • customGangDetection: Custom function for gang detection.

  • gangNames: Display names for gangs.

  • showGangNameInAlerts: Show gang name in alerts.

  • showGangTerritories: Show all gang-dominated territories to gang members.

  • gangJobs: List of jobs considered as gangs (if using 'jobs').


Snitcher System

Config.Snitcher = {
    probability = 0.15,
    postDealNotification = {
        notificationProbability = 0.15,
        blipDuration = 95000,
        pedSpawnDelay = 2000,
        pedDespawnTimer = 95000,
        blip = {
            sprite = 51,
            color = 5,
            scale = 1.0,
            flash = true,
            name = "Suspicious Activity Report"
        }
    },
    policeNotification = {
        title = "Drug Activity Report",
        message = "A citizen has reported suspicious drug activity in the area",
        duration = 5000,
        blip = {
            sprite = 51,
            color = 5,
            scale = 1.0,
            duration = 30000,
            flash = true
        }
    },
    behavior = {
        becomeContactOnLike = true,
        reportOnDislike = true
    },
    bigOffer = {
        enabled = true,
        multiplier = 30,
        minAmount = 50,
        maxAmount = 200
    },
    policeNotificationLocations = {
        { name = "Police Station Parking", x = 441.22, y = -982.42, z = 30.69, heading = 90.0 },
        -- Add more locations as needed
    },
    meetingLocations = {
        { name = "Beach Parking", x = -1183.21, y = -1511.11, z = 4.37, heading = 90.0 },
        -- Add more locations as needed
    },
    meetingTime = {
        minMinutes = 3,
        maxMinutes = 3,
        scaleWithAmount = true,
        baseMinutes = 25
    },
    snitcherDialogue = {
        enabled = true,
        dialogueId = "snitcher_dialogue",
        meetingBlip = {
            sprite = 51,
            color = 1,
            scale = 1.0,
            flash = true,
            name = "Drug Deal Location"
        },
        blipAppearTime = 600000,
        blipDuration = 1800000
    }
}
  • probability: Chance an NPC is a snitcher.

  • postDealNotification: Settings for police notification after a deal.

  • policeNotification: Police alert messages and blip settings.

  • behavior: What happens if a snitcher likes/dislikes the drug.

  • bigOffer: Enable/disable big offers for snitchers, set multiplier and amount range.

  • policeNotificationLocations: List of possible police notification locations.

  • meetingLocations: List of possible meeting locations for deals.

  • meetingTime: Meeting time intervals and scaling.

  • snitcherDialogue: Dialogue and blip settings for snitchers.


Goods System

Config.Goods = {
    enabled = true,
    categories = {
        drugs = { label = "Drugs", icon = "💊", color = "text-red-500" }
    },
    rarities = {
        common = { label = "Common", color = "text-gray-400", multiplier = 1.0 },
        rare = { label = "Rare", color = "text-blue-400", multiplier = 1.5 },
        exotic = { label = "Exotic", color = "text-purple-400", multiplier = 2.0 }
    },
    available = {
        weed_whitewidow = {
            label = "Weed Baggy",
            basePrice = 50,
            minPrice = 40,
            maxPrice = 70,
            amount = 10,
            minAmount = 5,
            maxAmount = 20,
            category = "drugs",
            rarity = "common",
            image = "weed_baggy.png",
            description = "Standard quality weed"
        },
        -- Add more goods as needed
    }
}
  • enabled: Enable/disable the goods system.

  • categories: Define categories for goods.

  • rarities: Define rarity levels and their properties.

  • available: List and configure available goods (drugs).


Dialogue Configuration

  • Config.Dialogue: Contains all dialogue trees, questions, answers, and voice lines for NPC interactions. You can fully customize the dialogue system here.


Contact Message System

Config.ContactMessage = {
    minInterval = 1,
    maxInterval = 3,
    counterOffer = {
        minPercent = 80,
        maxPercent = 120
    }
}
  • minInterval, maxInterval: Time (in seconds) between contact messages.

  • counterOffer: Min/max percent for counter offer acceptance.


Dealer System

Config.Dealers = {
    available = {
        {
            id = "dealer_1",
            name = "Benji Coleman",
            ped_model = "a_m_m_business_01",
            cut = 25,
            dealing_speed = 300000,
            locations = {"Home", "Motel Room 1"}
        },
        -- Add more dealers as needed
    },
    delivery = {
        arrival_time = 60000,
        spawn_distance = 150.0,
        stay_duration = 30000
    },
    auto_selling = {
        enabled = true,
        check_interval = 60000,
        min_quantity = 1,
        max_quantity_per_cycle = 1
    },
    withdrawal = {
        threshold = 100,
        deposit_method = 'bank'
    }
}
  • available: List of dealers, their names, models, cut, speed, and locations.

  • delivery: Dealer arrival time, spawn distance, and stay duration.

  • auto_selling: Enable/disable, set check interval, min/max quantity per cycle.

  • withdrawal: Set withdrawal threshold and deposit method (cash/bank).


Customization Examples

Add a New Drug

Config.Drugs['ecstasy'] = {
    label = "Ecstasy",
    image = "ecstasy.png",
    basePrice = 120,
    minPrice = 100,
    maxPrice = 180,
    amount = 8,
    minAmount = 2,
    maxAmount = 15,
    category = "pills",
    rarity = "rare",
    animation = {
        dict = "mp_player_inteat@burger",
        name = "mp_player_int_eat_burger",
        duration = 5000,
        scenario = "WORLD_HUMAN_AA_SMOKE"
    }
}

Change Police Requirement

Config.MinPolice = 2

Adjust Dealer Cut

Config.Dealers.available[1].cut = 30 -- Dealer 1 now takes a 30% cut

Enable/Disable Phone Apps

Config.PhoneApps.gamesApp = false -- Hide games app

Tip: After making changes, restart the resource for them to take effect.

For more advanced configuration, refer to the comments in config.lua or reach out for support.

Last updated