Accessible code
Shared = {
Locale = 'en',
Notify = {
duration = 5000, -- miliseconds
position = 'top-right' -- 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left'
},
Logs = {
enabled = true,
webhook = '',
servername = 'Uniq Scripts',
color = 6579450,
icon_url = 'https://dunb17ur4ymx4.cloudfront.net/webstore/logos/248d77847b320034db12949cf577772b654daadd.png'
},
Commands = {
adminpanel = {
name = 'adsadmin', -- command for accessing admin panel
restricted = 'group.admin', -- group that will have access to the command
}
},
Keys = { -- https://docs.fivem.net/docs/game-references/controls/
finish = 191,
cancel = 194,
},
Duration = { -- advertisement duration configuration
min = 1,
max = 7,
},
Currency = '€',
MaxAdPrice = 50000000, -- the maximum price the poster can input on the ad
PromotionPrice = 2000, -- price per promotion day (5 days = 10000 if PromotionPrice is 2000)
RPName = true, -- if false steam/rockstar name will be used in contact details
Target = {
ped = 'a_m_y_business_02', -- https://docs.fivem.net/docs/game-references/ped-models/
coords = vector4(-599.2646, -933.6917, 23.8644, 100.2251),
distance = 3
},
Blip = { -- https://docs.fivem.net/docs/game-references/blips/
id = 459,
scale = .8,
colour = 7,
label = 'Ad Board'
}
}
-- Framework
-- configured based on what you bought
function sendNotify(title, description, type)
lib.notify({
title = title,
description = description,
duration = Shared.Notify.duration,
type = type,
position = Shared.Notify.position
})
end
RegisterNetEvent('advertisements:notify', sendNotify)
-- Target
exports["qtarget"]:AddTargetModel(Shared.Target.ped, {
options = {
{
icon = "ad",
label = L('target.help'),
action = function()
ads()
end
}
},
distance = Shared.Target.distance
})
-- Discord Logs
local webhook = Shared.Logs.webhook
function logger(message)
if Shared.Logs.enabled then
if webhook ~= '' then
PerformHttpRequest(webhook, function(status) end, 'POST', json.encode({
username = cache.resource,
embeds = {{
color = Shared.Logs.color,
title = Shared.Logs.servername,
description = message,
footer = {
text = os.date(),
icon_url = Shared.Logs.icon_url
}
}}
}), { ['Content-Type'] = 'application/json' })
end
end
end
-- Command
lib.addCommand(Shared.Commands.adminpanel.name, {
help = L('command.adminpanel.description'),
restricted = Shared.Commands.adminpanel.restricted
}, function(source)
fetchCategories()
fetchAds()
TriggerClientEvent("advertisements:adminMenu", source)
end)
-- Date & time format
function getDateTime()
local dateTime = os.date("*t")
local year = dateTime.year
local month = dateTime.month
local day = dateTime.day
local hour = dateTime.hour
local minute = dateTime.min
local formattedDateTime = string.format("%04d-%02d-%02d %02d:%02d", year, month, day, hour, minute)
return formattedDateTime
end
-- Contact seller
function contactSeller(advertiser, sender, subject, message)
exports['qb-phone']:sendNewMailToOffline(advertiser, {
sender = sender,
subject = subject,
message = message
})
-- FOR ESX YOU HAVE TO CONFIGURE IT YOURSELF
end
Locales['en'] = {
['button.close'] = 'Close',
--- # Commands # ---
['command.adminpanel.description'] = 'Access the advertisements admin panel',
--- ! # Commands # ---
--- # Menu # ---
-- Menu
['menu.admin_panel'] = 'ADS Admin Panel',
['menu.create_category'] = 'Create Ad Category',
['menu.categories_list'] = 'Categories List',
['menu.manage_ads'] = 'Manage Ads',
['menu.settings'] = 'Settings',
['menu.reports'] = 'Reports',
-- Input
['input.category_label'] = 'Category Label',
['input.category_label.description'] = 'Input label for new category. Category with existing label will be ignored and not created.',
['input.ad_title'] = 'Title',
['input.ad_title.description'] = 'Input the advertisement title that will be displayed to buyers',
['input.ad_title.placeholder'] = '2023 Sultan RS - 265HP',
['input.ad_category'] = 'Category',
['input.ad_category.description'] = 'Select the advertisement category',
['input.cover_image'] = 'Cover Image',
['input.cover_image.description'] = 'Upload a cover image for the advertisement (optional)',
['input.ad_description'] = 'Description',
['input.ad_description.description'] = 'Text, images, or links that constitute the actual content of the advertisement',
['input.ad_description.placeholder'] = 'Find more information about this Sultan RS at www.uniq-scripts.com',
['input.ad_duration'] = 'Ad Duration (days)',
['input.ad_price'] = 'Price',
['input.ad_price.description'] = 'The price that potential buyers should pay',
['input.contact_seller'] = 'Contact Seller',
['input.contact_seller.description'] = 'Contact the advertiser and ask for all the information you need',
['input.contact_seller.placeholder'] = 'Hello, I want to buy your Sultan',
['input.contact_seller.message'] = 'Message',
['input.allow_comments'] = 'Allow Comments',
['input.comment_post'] = 'Write Your Comment',
['input.comment_post.description'] = 'You can ask questions, rate the advertiser etc...',
['input.allowed_ads'] = 'Allowed Ads',
['input.allowed_ads.description'] = 'Maximum number of Ads allowed per user',
['input.post_ad_price'] = 'Ad Price',
['input.post_ad_price.description'] = 'The price of placing an Ad on the Ad Board',
['input.notify_everyone'] = 'Notify All Online Players About Posted Advertisements',
['input.post_anonymous'] = 'Post as Anonymous',
['input.anonymous'] = 'Anonymous',
['input.report_post.reason'] = 'Report Reason',
['input.report_post.placeholder'] = 'Scammer',
-- Context
['context.no_categories'] = 'There are no categories to display',
['context.edit_label'] = 'Edit Category Label',
['context.category_label'] = 'Current Label',
['context.delete_category'] = 'Delete Category',
['context.delete_category.description'] = 'This action will permanently delete this category and all Ads in it',
['context.ads'] = 'Ads',
['context.advertising_board'] = 'Advertising Board',
['context.adverts'] = 'Advertisements',
['context.adverts.description'] = 'Discover a variety of Adverts across different categories',
['context.create_ad'] = 'Post Ad',
['context.create_ad.description'] = 'Easily create and share your own Ad',
['context.my_ads'] = 'My Ads',
['context.my_ads.description'] = 'Manage and track your own Ads',
['context.my_ads.promote_ad'] = 'Promote Ad',
['context.my_ads.remove_promotion'] = 'Remove Promotion',
['context.my_ads.promote_ad.description'] = 'Increase visibility and reach by promoting your Advert',
['context.my_ads.remove_promotion.description'] = 'Remove promotion from Ad #%s',
['context.my_ads.ad_promoted'] = 'This Ad is already promoted',
['context.my_ads.delete_ad'] = 'Delete Ad',
['context.my_ads.delete_ad.description'] = 'Remove the Ad permanently from the system',
['context.my_ads.edit_ad'] = 'Edit Ad',
['context.my_ads.edit_ad.description'] = 'Make quick adjustments to your ad\'s content and targeting',
['context.manage_ads.edit_ad.description'] = 'Make quick adjustments to Ad #%s content',
['context.no_ads_own'] = 'You have no created Ads',
['context.ads_select_category'] = 'Select Category',
['context.explore_category'] = 'Explore "%s" category',
['context.explore_category_empty'] = 'This category is empty',
['context.comment_post'] = 'Comment Post',
['context.comment_post.description'] = 'Comment on this post and ask questions or rate the advertiser',
['context.comments'] = 'Comments',
['context.comments.description'] = 'View & post comments on this Ad post',
['context.comment_post.disabled'] = 'Advertiser disabled commenting on this post',
['context.comments.view_help'] = 'Click to view a comment from %s',
['context.user_info'] = 'Advertiser Info',
['context.user_info.description'] = 'Get more information about the poster',
['context.user_info.anonymous'] = 'The advertiser decided to be Anonymous',
['context.report_post'] = 'Report Post',
['context.report_post.description'] = 'Report this post to the Admin Team',
['context.report_post.already_reported'] = 'You have already reported this post',
['context.report_id'] = 'Report #%s',
['context.report_id.description'] = 'This report was submitted for Ad #%s',
['context.report_post.reason.description'] = 'See the reason this post was reported for',
['context.report_post.delete_post'] = 'Delete Post',
['context.report_post.delete_post.description'] = 'Mark this report as valid and delete Ad #%s permanently',
['context.report_post.approve_post'] = 'Approve Post',
['context.report_post.approve_post.description'] = 'Mark this report as invalid and delete it permanently',
--- ! # Menu # ---
--- # Notify # ---
['notify.label_change_cancelled'] = 'Label change cancelled',
['notify.category_created'] = 'Category %s is successfully created',
['notify.label_edited'] = 'Label for Ad %s is edited. New label: %s',
['notify.row_exists'] = 'A row with the new name already exists. No update performed',
['notify.category_deleted'] = 'Category %s is deleted. This can\'t be restored',
['notify.ad_created'] = 'You have successfully posted an Ad in category "%s"',
['notify.ad_deleted'] = 'Ad #%s is deleted',
['notify.ad_edited'] = 'You have successfully edited Ad #%s',
['notify.no_money'] = 'You don\'t have enough money ($%s)',
['notify.promotion_bought'] = 'Promotion for Ad #%s successfully bought. Price paid: $%s',
['notify.ad_promoted'] = 'Ad #%s is successfully promoted',
['notify.promotion_removed'] = 'Ad #%s is not promoted anymore',
['notify.settings_updated'] = 'You have successfully updated settings for Advertisements System',
['notify.ad_limit'] = 'You have reached limit for posting ads (%s)',
['notify.commented'] = 'You have commented Ad post #%s',
['notify.success_report'] = 'Report has been successfully submitted',
['notify.report_deleted'] = 'Ad approved & report #%s deleted successfully',
--- ! # Notify # ---
--- # Text UI # ---
['textui.'] = {},
--- ! # Text UI # ---
--- # Alert Dialog # ---
['alert.delete_category.sure'] = {
('Are you sure you want to delete this category permanently? \n'),
('This will also delete all Ads created in this category. \n'),
},
['alert.promote_ad.sure'] = {
('Are you sure you want to promote this Advertisement? \n'),
(' \n'),
('Price per day: $%s. \n'),
('Ad expiration date: %s. \n'),
},
['alert.delete_ad.sure'] = {
('Are you sure you want to delete this Ad permanently? \n'),
('It is not possible to return it later. \n'),
},
['alert.advertiser_info'] = {
('Name: **%s** \n'),
('Phone Number: **%s** \n'),
('Ads Posted: **%s** \n')
},
['alert.report.delete_ad.sure'] = {
('Are you sure you want to mark this report as valid and delete Ad #%s permanently? \n'),
('It is not possible to return the Ad later. \n'),
},
['alert.report.approve_ad.sure'] = {
('Are you sure you want to mark this report as invalid and delete it permanently? \n'),
},
--- ! # Alert Dialog # ----
--- # Target # ---
['target.help'] = 'Look at the Advertisement Board',
--- ! # Target ---
--- # Logs # ---
['logs.created_category'] = '%s just created category with name "%s" and label "%s".',
['logs.edited_category_label'] = '%s just edited label of category "%s". New label: "%s"',
['logs.delete_category'] = '%s just deleted category "%s"',
['logs.ad_created'] = '%s just created Ad in category "%s", data: "%s"',
['logs.ad_deleted'] = '%s just deleted Ad #%s',
['logs.report_deleted'] = '%s just deleted report #%s',
['logs.ad_edited'] = '%s just edited Ad #%s, new data: "%s"',
['logs.ad_promoted'] = '%s just promoted Ad #%s',
['logs.promotion_removed'] = '%s just removed promotion from Ad #%s',
['logs.comment_posted'] = '%s just commented post #%s, comment: "%s"',
['logs.update_settings'] = 'Admin %s just updated settings: "%s"',
['logs.report_post'] = '%s just reported post #%s with reason: "%s"'
--- ! # Logs # ---
}
Last updated