Skip to content
All documentation

Pompa

Pompas spread across the map: attack them at fixed times, hold them for a while and grab the reward. With colored markers per state, zone, announcement for everyone and progress bar. Everything runs through the config, the script saves the cooldowns itself.

Requirements
  • ESX Legacy (es_extended, tested with 1.14)
  • oxmysql
  • OneSync (set onesync on in your server.cfg)

Features

  • Four states with their own color for marker (RGB) and blip (GTA blip color):
  • Attackable (green): E starts the pompa.
  • Under attack (red): a pompa is running here right now.
  • Cooldown (orange): after capture or abort, the remaining time is shown in the hint.
  • Outside hours (white): starting only works at the set times.
  • Zone: Every pompa has its own radius. The attacker has to stay inside. If he leaves the zone, he has a few seconds to come back (returnTime, default 5), otherwise the pompa is aborted. Players nearby see the zone as a sphere, on the map there is a radius blip.
  • Capture time and cooldown: In minutes, the same for all pompas. At the bottom of the screen a progress bar shows the remaining time and percent.
  • Announcement for everyone on start, capture and abort as a banner in the script's design. With banner = false it goes through the Announce function in config/functions.lua instead, where you hook in your own announce script.
  • Reward the same for all pompas: money (cash, bank, black money), items and weapons, also as a random amount.
  • Only one pompa at a time. If the attacker dies or goes offline, the pompa is aborted.
  • Blips on or off, main blip in the center of each pompa in the color of its state.
  • Cooldowns are kept after a server restart.
  • Discord logs for start, capture and abort.

Installation

  1. Put the off_pompa folder into resources.
  2. Add to your server.cfg after oxmysql and ESX:
cfg
set onesync on

ensure oxmysql
ensure es_extended
ensure off_pompa
  1. Add your pompas with their position in config/settings/config.pompas.lua, the reward in config/settings/config.lua.

The off_pompa_cooldowns table is created automatically. Items and weapons from the reward must exist in ESX, the server console reports unknown ones on start.

Configuration

config/settings/config.lua

OptionDefaultDescription
serverInfo.name'OFF SCRIPTS'Server name, shown in the UI instead of "OFF SCRIPTS"
serverInfo.locale'de'Language: de, en, pl, fr, es or it
serverInfo.color{ 155, 89, 255 }Color of the progress bar
serverInfo.design3UI design: 1 = Classic, 2 = Receipt, 3 = Storefront
times14:00 to 23:59Times when a pompa can be started (server time). Several possible, past midnight works too, empty = always
duration20Minutes until capture, applies to all pompas
cooldown15Minutes of cooldown after capture or abort, applies to all pompas
returnTime5Seconds to come back after leaving the zone, otherwise abort
bannertrueAnnouncement on start, capture and abort: true = banner from the script, false = your own announcement via Announce
rewardsBlack money, lockpicksReward for every captured pompa, see below
ignoreWeightfalsetrue = give items even beyond the carry weight, otherwise the item is lost when the inventory is full
colorsGreen, red, orange, whiteRGB color per state: attackable, attacking, cooldown, closed
markersee fileMarker type, size, opacity, view distance and distance for E
key38Key to start as control ID (E)
blips.enabledtrueBlips on or off
blips.sprite / scale / shortRange437 / 0.8 / trueLook of the main blip
blips.colors2, 1, 47, 0GTA blip color per state (blips can't do RGB)
blips.radius / radiusAlphatrue / 90Radius blip around the zone while a pompa is running

Reward, applies to every pompa:

lua
rewards = {
  { type = 'account', name = 'black_money', amount = { 20000, 30000 } },  -- random between
  { type = 'item',    name = 'lockpick',    amount = 3 },
  { type = 'weapon',  name = 'WEAPON_PISTOL', ammo = 60 },
},

config/settings/config.pompas.lua

Every pompa is an entry with position and radius of the zone.

lua
{
  id = 'hafen',                           -- fixed name, don't change it later
  label = 'Hafen',
  position = vec3(1003.6, -3108.6, 5.9),
  radius = 45.0,                          -- zone in meters
},

config/functions.lua

This is where you connect your own scripts. Errors in it end up in the console, the script keeps running.

FunctionPurpose
Notify(message, type) / HelpNotify(text)Notify and help text · Server: Notify(source, message, type)
ClientCanStart()false = don't start a pompa right now, e.g. cuffed or in a vehicle
ClientPompaStarted(pompa) / ClientPompaEnded(pompa, result)Your own pompa started or over, e.g. sound
Announce(message, kind, pompa)Server: your own announcement for everyone, only with banner = false. kind = 'start', 'captured' or 'aborted'. Default: ESX notify
ServerCanStart(source, pompa)return false, 'Text' = may not start, e.g. police, too few cops online, jobs
ServerPompaStarted(source, pompa)Pompa started
ServerPompaCaptured(source, pompa, rewards)Pompa captured, e.g. faction points
ServerPompaAborted(source, pompa, reason)Aborted, reason = 'zone', 'death', 'drop' or 'admin'

Example: starting only with at least 2 police officers on duty and not for the police themselves.

lua
function ServerCanStart(source, pompa)
  local xPlayer = ESX.GetPlayerFromId(source);

  if xPlayer.getJob().name == 'police' then
    return false, 'Als Polizist kannst du kein Pompa starten.';
  end

  if #ESX.GetExtendedPlayers('job', 'police') < 2 then
    return false, 'Es sind zu wenige Polizisten im Dienst.';
  end

  return true;
end

Example: your own announce script instead of notify, without an announcement on abort.
Example: your own announce script instead of the banner (banner = false), without an announcement on abort.

lua
function Announce(message, kind, pompa)
  if kind == 'aborted' then
    return;
  end

  TriggerClientEvent('dein_announce:show', -1, 'Pompa', message);
end

config/settings/config.server.lua and languages

Discord webhook pompa for start, capture and abort, url = '' turns the log off. All texts are in config/locales/ (one file per language).

In game

  • Marker: Every pompa has a marker in the color of its state. The marker shows what's possible right now: start, cooldown with remaining time or the times.
  • Start: Press E at the green marker. Everyone gets the announcement, you see the progress bar at the bottom.
  • Zone: A sphere appears around the pompa (for everyone nearby) and a radius blip on the map. If you walk out, the progress bar shows a countdown. If you're not back after returnTime seconds, the pompa is aborted.
  • Capture: When the time is up, you get the reward and the pompa goes into cooldown. After that it's attackable again.
  • Abort: Left the zone, died or went offline. In that case the pompa also goes into cooldown.
  • Only one pompa runs at a time. The time is the server's. A pompa started shortly before the end of the times runs until it's done.

For developers

lua
-- Server
local active = exports.off_pompa:GetActive()          -- nil if none is running
local state = exports.off_pompa:GetState('hafen')      -- 'attackable', 'attacking', 'cooldown' or 'closed'
local attacking = exports.off_pompa:IsAttacking(source)
exports.off_pompa:Abort()                              -- abort the running pompa
exports.off_pompa:ResetCooldown('hafen')               -- end the cooldown right away

-- Client
local state = exports.off_pompa:GetState('hafen')
local attacking = exports.off_pompa:IsAttacking()

Common issues

On start the script reports errors and hints in the server console.

ProblemSolution
All markers are whiteOutside of times. Check the server time.
Marker floats or is stuck in the groundGet the position again, standing directly on the ground.
Pompa aborts even though you're closeThe zone is a sphere, the height counts too. Zone too small for the terrain, increase radius.
Item reward doesn't arriveInventory full, see ignoreWeight. The console reports unknown items on start.
“OneSync is off”Add set onesync on to your server.cfg and restart.
Starting should only work for certain jobsAdjust ServerCanStart in config/functions.lua, example above.

Not bought yet?

View Pompa in the shop