Skip to content

๐Ÿ—ณ๏ธ BLN Elections System โ€‹

bln elections

๐Ÿ“บ Preview โ€‹

Video Preview

๐Ÿ’ฐ Buy Now โ€‹

Get it now

An immersive and feature-rich election system for your RedM server. Create election points, manage candidates, automate role assignments, and provide a seamless voting experience for your community.

๐Ÿ“ Description โ€‹

Transform your RedM server's governance with our comprehensive election system. Create dynamic voting points anywhere in the world, manage candidates through an intuitive interface, and automate winner announcements and role assignments through Discord integration. Perfect for faction leadership elections, mayor selections, or any community voting needs.

โœจ Features โ€‹

Core Features โ€‹

  • ๐Ÿ“ Create election points anywhere in the world
  • ๐ŸŽฏ Visual markers and blips for easy navigation
  • ๐Ÿ” Secure voting system with anti-cheat measures
  • ๐Ÿ“Š Real-time vote counting and results
  • ๐Ÿ† Automatic winner determination

Admin Features โ€‹

  • ๐Ÿ› ๏ธ Intuitive admin UI for election management
  • ๐Ÿ‘ฅ Easy candidate management
  • โšก Manual election completion option
  • ๐Ÿ“‹ Real-time election monitoring
  • ๐Ÿ—‘๏ธ Delete or modify existing elections

Discord Integration โ€‹

  • ๐Ÿค– Automatic role assignment for winners
  • ๐Ÿ“ข Beautiful embedded result announcements with:
    • Total votes cast
    • Winner announcement with vote percentage
    • Detailed breakdown of all candidates
    • Professional formatting with medals (๐Ÿฅ‡, ๐Ÿฅˆ, ๐Ÿฅ‰)
  • ๐Ÿ”— Discord user linking for candidates
  • ๐Ÿ“ˆ Detailed voting statistics

Technical Features โ€‹

  • ๐Ÿ’พ MySQL database for data persistence
  • ๐Ÿ”„ Efficient caching system
  • ๐Ÿ›ก๏ธ Anti-exploitation measures
  • โš™๏ธ Highly configurable
  • ๐ŸŽจ Customizable UI elements

๐Ÿ“บ Preview โ€‹

Watch Video Previw

๐Ÿ’ป Framework compatibility โ€‹

โœ… VORP โœ… REDEMRP(old/2023) โœ… RSG โœ…QBR.

๐Ÿ”ง Installation โ€‹

  1. Download the resource
  2. Extract to your resources folder
  3. Configure your config.lua as your needs
  4. ensure bln_elections in your resources.cfg

Dependencies โ€‹

โš™๏ธ Configuration โ€‹

lua
Config = {}

Config.ResetDatabaseOnStart = false -- Set to true if you want to reset the database on resource start (for testing purposes)
Config.debug = true -- Set to true to enable debug messages

-- Admin Configuration
Config.AdminCommand = 'election' -- Base command for all election actions
Config.AdminGroups = {'admin'} -- Groups that can manage elections

-- Visual Settings
Config.Blip = {
    enabled = true,
    sprite = -272216216, -- Election blip sprite
    name = "Election Point"
}

-- Marker Settings
Config.Marker = {
    enabled = true,
    type = 0x94FDAE17, -- Marker type
    scale = vector3(1.0, 1.0, 1.0),
    color = {r = 255, g = 255, b = 255, a = 30}
}

-- Screen FX Settings
Config.screenFx = {
    enable = true,
    fx = "WheelHUDIn",
    duration = 0,
    looped = true
}

-- Prompt Settings
Config.Prompt = {
    group = "election_vote",
    key = 0xC7B5340A,
    text = "Vote Now"
}

-- Discord Settings
Config.Discord = {
    enabled = true,
    webhook = "YOUR_WEBHOOK_URL",     -- For results announcements
    botToken = "YOUR_BOT_TOKEN",      -- From bot settings
    guildId = "YOUR_GUILD_ID",        -- Server ID
    embedColor = 16766720,            -- Color for embeds
    serverName = "Your Server Name",
    footer = {
        text = "RedM Elections System",
        icon_url = "YOUR_SERVER_ICON"
    }
}

-- Gameplay Settings
Config.VoteDistance = 2.0 -- Distance to show vote prompt
Config.NotificationDuration = 4000 -- Duration for notifications in ms

-- Language
Config.Lang = {
    electionCreated = "Election point created successfully",
    alreadyVoted = "You have already voted in this election",
    voteRecorded = "Your vote has been recorded",
    invalidElection = "This election is no longer valid",
    noPermission = "You don't have permission to do this",
    electionExpired = "This election has expired",
    winnerAnnounced = "The election has concluded! Winner: %s",
    roleAssigned = "Winner role has been assigned",
    invalidCandidate = "Invalid candidate selection",
    electionEnded = "Election ended successfully",
    electionDeleted = "Election deleted successfully",
    notEligibleToVote = 'You are not eligible to vote in this election',
    notEligibleToCreate = 'You are not eligible to create elections'
}

I'll rewrite the custom configuration section to be more user-friendly with step-by-step examples:

๐Ÿช„ Custom Configuration โ€‹

The election system can be customized using custom.lua to control who can vote, create elections, and more.

โš ๏ธ The filters below will not work until you set them to enabled = true, if false then will use the defaults.

1. Voter Eligibility โ€‹

Control who can vote in elections.

lua
-- Default (everyone can vote)
Custom.VoterEligibility = {
    enabled = false,
    checkFunction = function(source)
        return true
    end
}

-- Examples:

-- VORP: Only Blackwater citizens can vote
Custom.VoterEligibility = {
    enabled = true,
    checkFunction = function(source)
        local User = exports.vorp_core:getUser(source)
        local Character = User.getUsedCharacter
        return Character.job == "citizen" and Character.jobLabel == "Blackwater"
    end
}

-- RedEM: Only Valentine residents can vote
Custom.VoterEligibility = {
    enabled = true,
    checkFunction = function(source)
        local User = exports.redem_roleplay:RedEM().GetPlayer(source)
        return User.faction == "valentine"
    end
}

-- RSG: Only players with specific job can vote
Custom.VoterEligibility = {
    enabled = true,
    checkFunction = function(source)
        local Player = exports['rsg-core']:GetPlayer(source)
        return Player.PlayerData.job.name == "police"
    end
}

2. Election Creator Eligibility โ€‹

Control who can create elections (beyond admin rights).

lua
-- Default (all admins can create)
Custom.CreatorEligibility = {
    enabled = false,
    checkFunction = function(source)
        return true
    end
}

-- Examples:

-- VORP: Only mayors can create elections
Custom.CreatorEligibility = {
    enabled = true,
    checkFunction = function(source)
        local User = exports.vorp_core:getUser(source)
        local Character = User.getUsedCharacter
        return Character.job == "mayor"
    end
}

-- RedEM: Only sheriffs can create elections
Custom.CreatorEligibility = {
    enabled = true,
    checkFunction = function(source)
        local User = exports.redem_roleplay:RedEM().GetPlayer(source)
        return User.job == "sheriff"
    end
}

3. Custom Admin Check โ€‹

Override the default admin check system.

lua
-- Default (uses Config.AdminGroups)
Custom.IsPlayerAdmin = {
    enabled = false,
    checkFunction = function(source)
        return false
    end
}

-- Examples:

-- VORP: Custom admin check
Custom.IsPlayerAdmin = {
    enabled = true,
    checkFunction = function(source)
        local User = exports.vorp_core:getUser(source)
        return User.group == "admin" or User.group == "moderator"
    end
}

-- Using database check
Custom.IsPlayerAdmin = {
    enabled = true,
    checkFunction = function(source)
        local identifier = GetPlayerIdentifier(source, 0)
        local result = exports.oxmysql:fetchSync('SELECT 1 FROM admins WHERE identifier = ?', {identifier})
        return result and #result > 0
    end
}

4. Custom Identifier โ€‹

Control how voters are identified in the database.

lua
-- Default (Steam ID)
-- Custom.getIdentifier = function(source)
--     return GetPlayerIdentifier(source, 0)
-- end

-- Examples:

-- Using character ID instead of Steam ID
Custom.getIdentifier = function(source)
    local User = exports.vorp_core:getUser(source)
    local Character = User.getUsedCharacter
    return Character.charIdentifier
end

-- Using Discord ID
Custom.getIdentifier = function(source)
    return GetPlayerIdentifier(source, 3) -- Discord identifier
end

This allows you to:

  • Use different identifier types (steam, license, etc.)
  • Use character-based voting instead of account-based
  • Implement your own custom identification logic
  • Control how duplicate votes are prevented

Leave it commented as it is, to use the default logic (steam).

๐Ÿ’ก Tip: Enable debug mode in config.lua to see helpful messages while setting up custom configurations.

๐Ÿช Discord Setup Guide โ€‹

  1. Create Discord Application

  2. Configure Bot Settings

    • Enable "Server Members Intent"
    • Enable "Message Content Intent"
  3. Bot Permissions Required

    • Manage Roles
    • Send Messages
    • Embed Links
    • Read Message History
  4. Invite Bot to Your Server

    • Go to OAuth2 > URL Generator
    • Select scopes: bot
    • Select required permissions
    • Use generated URL to invite bot
  5. Configure in config.lua:

lua
-- Discord Settings
Config.Discord = {
    enabled = true,
    webhook = "YOUR_WEBHOOK_URL",     -- For results announcements
    botToken = "YOUR_BOT_TOKEN",      -- From bot settings
    guildId = "YOUR_GUILD_ID",        -- Server ID
    embedColor = 16766720,            -- Color for embeds
    serverName = "Your Server Name",
    footer = {
        text = "RedM Elections System",
        icon_url = "YOUR_SERVER_ICON"
    }
}

๐Ÿค Support โ€‹

Need help? Have questions? Join our Discord server for support and updates!

  • ๐Ÿ’ฌ Discord: Join Here
  • ๐ŸŽฎ Live support and community help
  • ๐Ÿ”„ Regular updates and improvements