#How to get weapons as admin

1 messages · Page 1 of 1 (latest)

umbral swift
#

I am the admin the of server but I am not able to get all the weapons or money how to do that

cobalt sail
umbral swift
cobalt sail
#

Too long to write everything in detail XD And I don't speak English but French... good luck with someone else 🤞 pouce

wooden yarrow
#

/setgroup (ur id) admin

hexed plume
#

both esx and qbcore has commands for both money,weapons and all that stuff, literally no need to change anything in the database, besides that he would need to restart or relog if he changes the db, it doesnt live update

#

so saying that is just dumb.

cobalt sail
odd oxide
odd oxide
umbral swift
odd oxide
#

/giveitem - gives item to a player

umbral swift
# odd oxide

Thank you also one thing can I get all the weapons as admin?

odd oxide
#

don't think there's a built in command for that

umbral swift
odd oxide
#

fxmanifest.lua

fx_version 'cerulean'
game        'gta5'

description 'Gives every weapon server-side via QBCore'
version     '1.0.0'

dependency 'qb-core'

server_scripts {
  'config.lua',
  'server.lua'
}

config.lua

-- config.lua
Config = {}

-- default ammo per weapon if not passed as an arg
Config.Ammo = 250

server.lua

-- server.lua
local QBCore = exports['qb-core']:GetCoreObject()

QBCore.Commands.Add(
  'allweapons',
  'Give yourself every weapon',
  {
    { name = 'ammo', help = 'How much ammo per weapon (optional)' }
  },
  false,
  function(source, args)
    local ammo = tonumber(args[1]) or Config.Ammo
    -- iterate all defined weapons
    for weaponName, _ in pairs(QBCore.Shared.Weapons) do
      -- QBCore’s server-side function:
      -- params: playerServerId, weaponName, ammoCount
      QBCore.Functions.AddWeapon(source, weaponName, ammo)
    end
    -- notify client via QBCore’s notify event
    TriggerClientEvent(
      'QBCore:Notify',
      source,
      ('You received all weapons with %d rounds each'):format(ammo),
      'success'
    )
  end
)
umbral swift
arctic fractalBOT
umbral swift
#

Am I right?

odd oxide
#

yes

#

unless it's in an ensured folder

umbral swift
odd oxide
#

if the server.cfg already has an ensure [FOLDERNAME]

#

it will ensure all the resources in it

#

so you don't have to manually ensure giveweapon