Configuration
Import things for crate drop
Open server file - server/open.lua
In this file you can add your own functions and framework!
-- in case you are using ESX inventory , you can use xPlayer to give item,
-- this stands the same for qbx/qbcore , for any other case that you might need source , you can use that as well !
function AddItem(xPlayer,source,itemName, itemCount)
exports.ox_inventory:AddItem(source, itemName, itemCount)
end
-- in case you are using ESX Framework , you can use xPlayer to add black money,
-- in case you are using qbx/qbcore, you can add black money via addItem
function AddBlackMoney(xPlayer,source, money, amount)
exports.ox_inventory:AddItem(source, money, amount)
-- xPlayer.addAccountMoney('black_money', blackMoney)
end
function AddWeapon(xPlayer, source, weaponName, ammo)
-- [Ox Inventory]
exports.ox_inventory:AddItem(source, weaponName, 1,{ammo = ammo})
--[ESX Framework]
-- xPlayer.addWeapon(weaponName, weaponAmmo)
end
function GetPlayer(source)
return exports.qbx_core:GetPlayer(source)
end
Open server file - server/notify/open_notify.lua
In this file you can add your own notify - SERVER EVENT OF NOTIFY
function OpenNotify(source,notifyConfig, description)
TriggerClientEvent('ox_lib:notify', source, {
title = notifyConfig.title,
description = description,
type = notifyConfig.typeMessage,
duration = notifyConfig.duration
})
end
Config Files
Config Client - config/client/config.lua
Config = { Circle = {}, Blip = {} }
-- Circle Blip
Config.Circle.Color = 1
Config.Circle.Alpha = 150
--
-- Crate Blip
Config.Blip.Name = 'Crate Drop'
Config.Blip.Sprite = 478
Config.Blip.Size = 0.8
--
-- Props
Config.Props = {
chuteModel = 'p_parachute1_s',
crateModel = 'ex_prop_crate_closed_bc'
}
--
Config.ClientNotify = {
nothing_loot = {
title = 'Crate Drop',
isFormatted = false,
description = "It doesn't have anything you can collect.",
typeMessage = "error",
duration = 4000
},
forbidden_job = {
title = 'Crate Drop',
isFormatted = false,
description = "Your job is blacklisted so you can't take the crate",
typeMessage = "error",
duration = 4000
},
chance_lost = {
title = 'Crate Drop',
isFormatted = false,
description = "You cannot open the box again. You miss your chance.",
typeMessage = "error", duration = 4000
},
}
-- Data
Config.crateData = { crateBlip = nil, circleBlip = nil, crateCircleRadius = nil, canOpenCrate = false }
--
-- Crate Circle Radius
Config.crateCircleRadius = 150.0
--
-- Collecting Delay
Config.collectingDelay = 20 * 1000 -- 20 Seconds.
--
Config Server - config/server/config.lua
Config = {}
Config.Notify = {
already_fall = {
title = 'Crate Drop',
isFormatted = false,
description = 'Crate Drop is already fall',
typeMessage = "error", duration = 4000
},
reward_item = {
title = 'Crate Drop',
isFormatted = true,
description = 'You got x%d %s in your inventory',
typeMessage = "success", duration = 4000
},
reward_black_money = {
title = 'Crate Drop',
isFormatted = true,
description = 'You got %s Black Money',
typeMessage = "success",
duration = 4000
},
reward_weapons = {
title = 'Crate Drop',
isFormatted = true,
description = 'You got %s Black Money',
typeMessage = "success",
duration = 4000
},
}
Config.ChatMessages = {
message_before_fall = 'The Crate Drop will drop in 10 minutes in a random area. Prepare!',
crate_drop_fall = 'Crate Drop has fallen! Look at the map to locate the area.',
crate_drop_has_collected = 'Crate Drop was collected!',
crate_drop_has_not_collected = 'Crate Drop was not collected by anyone',
chat_image = "https://media.discordapp.net/attachments/859618317858111494/1352768635575337070/crate_drop_img.png?ex=67df3777&is=67dde5f7&hm=02002854c547689d94a25f3d856a710f74cfa88daf27b454b7c99675d9450ac2&=&format=webp&quality=lossless"
}
Config.DiscordWebhook = 'https://discord.com/api/webhooks/1352775436425236550/8OkQrUVKjprk2UMyd0_NJfiKJ23gKCWVYbK6e-c8k2cpQl_QtZwzztEFHb048Is1yL4F'
Config.Locations = {
{ name = 'Crate Drop', pos = vec3(2949.61, 2787.93, 41.0), r = 300.0 },
{ name = 'Crate Drop', pos = vec(2338.01, 2546.48, 47.71), r = 300.0 },
{ name = 'Crate Drop', pos = vec(1076.44, -3062.35, 5.91), r = 300.0 },
{ name = 'Crate Drop', pos = vec(71.0, 3709.03, 39.75), r = 300.0 },
{ name = 'Crate Drop', pos = vec(1074.83, 2359.88, 44.18), r = 300.0 }
}
Config.CommandCrateDropInfo = {
commandName = 'drop_crate',
help = 'Start crate drop event',
restricted = 'group.admin'
}
Config.BlacklistJobs = {'police', 'fbi', 'ambulance', 'sheriff'}
Config.NotifyTime = {
['08:50'] = true, ['12:20'] = true, ['14:20'] = true,
['16:20'] = true, ['18:20'] = true, ['20:20'] = true,
}
Config.Time = {
['09:00'] = true, ['12:30'] = true, ['14:30'] = true,
['16:30'] = true, ['18:30'] = true, ['20:30'] = true,
}
Config.BlackMoney = 24000 -- This is splitting this / 2 for minimum and maximum random amount.
Config.Items = {
{ name = 'sandwich', count = math.random(10, 12) },
{ name = 'bulletproof', count = math.random(5, 8) },
}
Config.Loadout = {
{ name = 'WEAPON_PISTOL', ammo = math.random(100, 200) },
{ name = 'WEAPON_MICROSMG', ammo = math.random(200, 350) },
}
Config.DROP_ALWAYS_WEAPONS = true
Config.DROP_MAX_WEAPONS = 1
Last updated