finished locales EN
This commit is contained in:
1 parent
37f86bf50d
commit
683eaff7de
46 files changed
+965
-1049
No files matched your search
@@ -0,0 +1,64 @@
|
||||
|
||||
local Target = {
|
||||
Travellingmerchant = {
|
||||
vector4(-119.66, -977.43, 304.25, 88.21),
|
||||
vector4(-1522.93, 1476.01, 111.45, 41.25),
|
||||
vector4(-3278.98, 973.38, 5.35, 101.53),
|
||||
},
|
||||
}
|
||||
|
||||
local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)]
|
||||
|
||||
|
||||
|
||||
local stores = {
|
||||
travel = {
|
||||
tab_paper = 50,
|
||||
bakingsoda = 25,
|
||||
isosafrole = 25,
|
||||
mdp2p = 25,
|
||||
lysergic_acid = 25,
|
||||
diethylamide = 25,
|
||||
lockpick = 2,
|
||||
emptyvial = 2,
|
||||
needle = 2,
|
||||
cokeburner = 25,
|
||||
crackburner = 2,
|
||||
lsdburner = 2,
|
||||
heroinburner = 2,
|
||||
mdlean = 50,
|
||||
weedgrinder = 25,
|
||||
mdbutter = 25,
|
||||
flour = 25,
|
||||
chocolate = 25,
|
||||
butane = 25,
|
||||
butanetorch = 2,
|
||||
dabrig = 2,
|
||||
mdwoods = 2,
|
||||
leancup = 25,
|
||||
xtcburner = 25,
|
||||
},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetMerchant', function(source)
|
||||
return loc, stores.travel
|
||||
end)
|
||||
|
||||
|
||||
|
||||
RegisterServerEvent("md-drugs:server:purchaseGoods", function(item)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, loc, 10) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not stores.travel[item] then
|
||||
ps.notify(src, ps.lang('Catches.invalidItem'), "error")
|
||||
return
|
||||
end
|
||||
if ps.removeMoney(src, 'cash', stores.travel[item]) then
|
||||
ps.addItem(src, item, 1)
|
||||
else
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
+8
-8
@@ -42,7 +42,7 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, cocaineLocations.MakePowder[num].loc, 3.5) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
local tier = 'tier1'
|
||||
@@ -55,7 +55,7 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, cocaineRecipes['cocaine']['cokepowder'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, cocaineRecipes['cocaine']['cokepowder'][tier].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
@@ -64,7 +64,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
|
||||
local src = source
|
||||
local tier = 'tier1'
|
||||
if not ps.checkDistance(src, cocaineLocations.CuttingCoke[num].loc, 2.5) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if Config.TierSystem then
|
||||
@@ -81,7 +81,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, cocaineRecipes['cocaine']['cutcoke'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, cocaineRecipes['cocaine']['cutcoke'][tier].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
@@ -90,7 +90,7 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
||||
local src = source
|
||||
local tier = 'tier1'
|
||||
if not ps.checkDistance(src, cocaineLocations.BaggingCoke[num].loc, 2.5) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if Config.TierSystem then
|
||||
@@ -106,13 +106,13 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, cocaineRecipes['cocaine']['bagcoke'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, cocaineRecipes['cocaine']['bagcoke'][tier].take)
|
||||
return
|
||||
end
|
||||
AddRep(src, 'coke')
|
||||
else
|
||||
if not ps.craftItem(src, cocaineRecipes['cocaine']['bagcoke'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, cocaineRecipes['cocaine']['bagcoke'][tier].take)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -122,7 +122,7 @@ local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
|
||||
for k, v in pairs (cokecut) do
|
||||
ps.createUseable(k, function(source, item)
|
||||
local src = source
|
||||
if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, 'You Need Baking Soda For this', 'error') return end
|
||||
if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, ps.lang('coke.needBakingSoda'), 'error') return end
|
||||
if ps.hasItem(src,item.name) then
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
if not check then return end
|
||||
|
||||
@@ -21,8 +21,8 @@ strength = number -- how long you are strong boi
|
||||
]]
|
||||
local Consume = {
|
||||
-- meth
|
||||
methbags = { time = 4000, effect = 'meth', anim = "smoke", ps.progressbartext = "Injesting",
|
||||
add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}},
|
||||
methbags = { time = 4000, effect = 'meth', anim = "smoke", progressbartext = "Injesting",
|
||||
add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}},
|
||||
cokebaggy = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }},
|
||||
cokebaggystagetwo = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }},
|
||||
cokebaggystagethree = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }},
|
||||
@@ -143,22 +143,22 @@ xanax = { anim = 'pill', effect = 'none', add = { stress = -40
|
||||
}
|
||||
|
||||
for k, v in pairs(Consume) do
|
||||
CUI(k, function(source, item)
|
||||
if not Itemcheck(source, k, 1) then return end
|
||||
ps.createUseable(k, function(source, item)
|
||||
if not ps.hasItem(source, k, 1) then return end
|
||||
local time = v.time or Consumables.defaulttime
|
||||
local effect = v.effect or 0
|
||||
local anim = v.anim or Consumables.defaultanim
|
||||
local ps.progressbartext = v.ps.progressbartext or Consumables.defaultprogresstext
|
||||
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
|
||||
local add = v.add or {hunger = 0}
|
||||
local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, ps.progressbartext, add, k)
|
||||
local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k)
|
||||
if done then
|
||||
RemoveItem(source, k, 1)
|
||||
ps.removeItem(source, k, 1)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||
local Player = getPlayer(source)
|
||||
local Player = ps.getPlayer(source)
|
||||
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
|
||||
if stat == "thirst" then
|
||||
local value = thirst + statval
|
||||
@@ -176,6 +176,5 @@ RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
|
||||
local value = Player.PlayerData.metadata.armor + statval
|
||||
TriggerEvent('hospital:server:SetArmor', value)
|
||||
TriggerClientEvent('hud:client:UpdateStress', source, Player.PlayerData.metadata.armor, value)
|
||||
else
|
||||
end
|
||||
end)
|
||||
@@ -135,7 +135,7 @@ local function beingRobbed(source, item, amount, ped)
|
||||
local math = math.random(1,100)
|
||||
if math <= robChance then
|
||||
ps.removeItem(src, item, amount)
|
||||
ps.notify(src, 'You Got Robbed Nerd', 'error')
|
||||
ps.notify(src, ps.lang('Cornerselling.gotRobbed'), 'error')
|
||||
RobbedDrugs[ps.getIdentifier(source)] = {item = item, amount = amount, ped = ped}
|
||||
return true
|
||||
else
|
||||
@@ -148,7 +148,7 @@ local function getDrugBack(source, item, amount)
|
||||
if RobbedDrugs[ps.getIdentifier(source)] then
|
||||
if RobbedDrugs[ps.getIdentifier(source)].item == item and RobbedDrugs[ps.getIdentifier(source)].amount == amount then
|
||||
ps.addItem(src, item, amount)
|
||||
ps.notify(src, 'You Got Your Drugs Back', 'success')
|
||||
ps.notify(src, ps.lang('Cornerselling.gotBack'), 'success')
|
||||
RobbedDrugs[ps.getIdentifier(source)] = nil
|
||||
return true
|
||||
end
|
||||
@@ -170,7 +170,7 @@ ps.registerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(
|
||||
if item > 15 then item = 15 end
|
||||
local amount = math.random(1, item)
|
||||
local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * rep.price
|
||||
DrugDeals[ps.getIdentifier(source)] = {item = k, amount = amount, price = math.floor(price), ped = ped}
|
||||
DrugDeals[ps.getIdentifier(source)] = {item = k, amount = amount, price = math.floor(price), ped = ped}
|
||||
return DrugDeals[ps.getIdentifier(source)]
|
||||
end
|
||||
end
|
||||
@@ -180,7 +180,7 @@ end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:hasDrugs', function(source)
|
||||
for k, v in pairs(Drugs) do
|
||||
if hasItem(source, k, 1) then
|
||||
if ps.hasItem(source, k, 1) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -204,16 +204,15 @@ local function csCheck(src, item, amount, price)
|
||||
return false
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
|
||||
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
|
||||
local src = source
|
||||
if not csCheck(src, item, amount, price) then return end
|
||||
if not ps.removeItem(src, item, amount) then
|
||||
ps.notify(src, 'You Do Not Have Enough Of This Item', 'error')
|
||||
ps.notify(src, ps.lang('Cornerselling.notEnough'), 'error')
|
||||
DrugDeals[ps.getIdentifier(src)] = nil
|
||||
return
|
||||
end
|
||||
AddRep(src, 'cornerselling', Drugs[item].rep * amount)
|
||||
--Log(string.format('%s Sold %s Of %s For A Price Of $%s !', GetName(src),amount, item, price), 'cornerselling')
|
||||
DrugDeals[ps.getIdentifier(src)] = nil
|
||||
ps.addMoney(src, 'cash', price)
|
||||
end)
|
||||
@@ -225,8 +224,8 @@ RegisterNetEvent('md-drugs:server:getBackRobbed', function()
|
||||
RobbedDrugs[ps.getIdentifier(source)] = nil
|
||||
end)
|
||||
|
||||
lib.addCommand('cornersell', {
|
||||
help = 'Sell Things On The Corner',
|
||||
ps.registerCommand('cornersell', {
|
||||
help = ps.lang('Cornerselling.comDes'),
|
||||
params = {
|
||||
},
|
||||
}, function(source, args, raw)
|
||||
|
||||
+6
-6
@@ -27,7 +27,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
local src = source
|
||||
local tier = 'tier1'
|
||||
if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if Config.TierSystem then
|
||||
@@ -44,7 +44,7 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, crackRecipe['crack']['cookcrack'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, crackRecipe['crack']['cookcrack'][tier].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
@@ -54,7 +54,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
||||
local src = source
|
||||
local tier = 'tier1'
|
||||
if not ps.checkDistance(src, CrackLocations.bagcrack[num].loc, 2.0) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if Config.TierSystem then
|
||||
@@ -71,7 +71,7 @@ RegisterServerEvent('md-drugs:server:bagcrack', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, crackRecipe['crack']['bagcrack'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, crackRecipe['crack']['bagcrack'][tier].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
@@ -93,8 +93,8 @@ end
|
||||
|
||||
RegisterNetEvent("md-drugs:server:failcrackone", function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.makecrack[num].loc, 2.0) then
|
||||
ps.notify(src, 'You are not in the correct location', 'error')
|
||||
if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
local items = {
|
||||
|
||||
+69
-34
@@ -80,13 +80,25 @@ local dloc = {
|
||||
{coords = vector4(223.98, 121.53, 102.76, 259.68)},
|
||||
{coords = vector4(102.19, -255.02, 50.05, 83.59)},
|
||||
}
|
||||
ps.registerCallback('md-drugs:server:getDealers', function(data)
|
||||
local Products = {
|
||||
{name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:dealerList', function()
|
||||
return Products
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:getDealers', function(source)
|
||||
local check = MySQL.query.await('SELECT * FROM dealers', {})
|
||||
local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
|
||||
if not check[1] then
|
||||
if not check[1] then
|
||||
MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'})
|
||||
Wait(2000)
|
||||
local check2 = MySQL.query.await('SELECT * FROM dealers', {})
|
||||
Wait(2000)
|
||||
local check2 = MySQL.query.await('SELECT * FROM dealers', {})
|
||||
return check2
|
||||
else
|
||||
return check
|
||||
@@ -99,9 +111,9 @@ local DeliveryItems = {
|
||||
{ item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data)
|
||||
ps.registerCallback('md-drugs:server:GetDeliveryItem', function(source, data)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local Player = ps.getPlayer(src)
|
||||
local itemnum = math.random(1, #DeliveryItems)
|
||||
local item = DeliveryItems[itemnum].item
|
||||
local amount = math.random(1,4)
|
||||
@@ -115,61 +127,70 @@ ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data)
|
||||
})
|
||||
if not check[1] then
|
||||
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
|
||||
{Player.PlayerData.citizenid, json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||
AddItem(Player.PlayerData.source, item, amount)
|
||||
{ps.getIdentifier(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
|
||||
ps.addItem(src, item, amount)
|
||||
return true, item, amount, coord
|
||||
else
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
|
||||
if timeout > 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) ps.notify(src, 'You Failed To Make It In Time!', 'error' ) return false end
|
||||
ps.notify(src,'You Already Have A Delivery To Make', 'error' ) return false, item, amount, coord
|
||||
|
||||
if timeout > 15 then
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)})
|
||||
ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' )
|
||||
return false
|
||||
end
|
||||
ps.notify(src,ps.lang('Deliveries.alreadyDelivering'), 'error' )
|
||||
return false, item, amount, coord
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
local Player = ps.getPlayer(src)
|
||||
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)})
|
||||
if not check[1] then return end
|
||||
local time = os.time()
|
||||
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
|
||||
local itemData = json.decode(check[1].itemdata)
|
||||
if timeout >= 15 then MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid}) ps.notify(source, 'You Failed To Make It In Time!', 'error' ) return end
|
||||
if timeout >= 15 then
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)})
|
||||
ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' )
|
||||
return
|
||||
end
|
||||
if item ~= itemData.item then return end
|
||||
if amount ~= itemData.amount then return end
|
||||
if RemoveItem(src, item, amount) then
|
||||
if ps.removeItem(src, item, amount) then
|
||||
for k, v in pairs (DeliveryItems) do
|
||||
if v.item == item then
|
||||
local income = math.random(v.payout.min, v.payout.max)
|
||||
Player.Functions.AddMoney('cash', income)
|
||||
ps.addMoney(src, 'cash', income)
|
||||
AddRep(src, 'dealerrep')
|
||||
end
|
||||
end
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Player.PlayerData.citizenid})
|
||||
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)})
|
||||
end
|
||||
end)
|
||||
|
||||
lib.addCommand("newdealer", {
|
||||
help = "Place a dealer (Admin Only)",
|
||||
params = {
|
||||
{ name = "name", help = "Dealer Name", type = "string" },
|
||||
{ name = "min", help = "Minimum Time", type = "number" },
|
||||
{ name = "max", help = "Maximum Time", type = "number" }
|
||||
ps.registerCommand("newdealer", {
|
||||
help = ps.lang('Deliveries.newDealerHelp.help'),
|
||||
description = {
|
||||
{ name = "name", help = ps.lang('Deliveries.newDealerHelp.name'), type = "string" },
|
||||
{ name = "min", help = ps.lang('Deliveries.newDealerHelp.timeMin'), type = "number" },
|
||||
{ name = "max", help = ps.lang('Deliveries.newDealerHelp.timeMax'), type = "number" }
|
||||
},
|
||||
restricted = "admin"
|
||||
admin = true,
|
||||
}, function(source, args)
|
||||
local ped = GetPlayerPed(source)
|
||||
local coords = GetEntityCoords(ped)
|
||||
local Player = getPlayer(source)
|
||||
local Player = ps.getPlayer(source)
|
||||
if not Player then return end
|
||||
|
||||
local dealerName = args.name
|
||||
local pos = json.encode({x = coords.x, y = coords.y, z = coords.z})
|
||||
|
||||
|
||||
local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName })
|
||||
if result then
|
||||
return ps.notify(source,"Already Exists", "error")
|
||||
return ps.notify(source,ps.lang('Deliveries.DealerExists'), "error")
|
||||
end
|
||||
|
||||
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
|
||||
@@ -188,12 +209,12 @@ lib.addCommand("newdealer", {
|
||||
end)
|
||||
end)
|
||||
|
||||
lib.addCommand("deletedealer", {
|
||||
help = "Delete a dealer (Admin Only)",
|
||||
params = {
|
||||
{ name = "name", help = "Dealer Name", type = "string" }
|
||||
ps.registerCommand("deletedealer", {
|
||||
help = ps.lang('Deliveries.deleteDealerHelp.help'),
|
||||
description = {
|
||||
{ name = "name", help = ps.lang('Deliveries.deleteDealerHelp.name'), type = "string" }
|
||||
},
|
||||
restricted = 'group.admin'
|
||||
admin = true
|
||||
}, function(source, args)
|
||||
local dealerName = args.name
|
||||
local result = MySQL.scalar.await('SELECT * FROM dealers WHERE name = ?', { dealerName })
|
||||
@@ -202,8 +223,22 @@ lib.addCommand("deletedealer", {
|
||||
MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName })
|
||||
QBConfig.Dealers[dealerName] = nil
|
||||
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
|
||||
TriggerClientEvent('QBCore:ps.notify', source, "Dealer Deleted", "success")
|
||||
ps.notify(source, ps.lang('Deliveries.deleteDealerSuccess'), "success")
|
||||
else
|
||||
TriggerClientEvent('QBCore:ps.notify', source, "Who You Tryna Delete", "error")
|
||||
ps.notify(source, ps.lang('Deliveries.deleteDealerFail'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num)
|
||||
local src = source
|
||||
local itemData = Products[num]
|
||||
if not itemData then return end
|
||||
local Player = ps.getPlayer(src)
|
||||
if not Player then return end
|
||||
if not ps.removeMoney(src, 'cash', itemData.price) or not ps.removeMoney(src,'bank', itemData.price) then
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), 'error')
|
||||
return
|
||||
end
|
||||
ps.addItem(src, itemData.name, 1)
|
||||
ps.notify(src, string.format(ps.lang('Deliveries.buyItemSuccess'), 1, ps.getLabel(itemData.name), itemData.price), 'success')
|
||||
end)
|
||||
+34
-65
@@ -1,13 +1,36 @@
|
||||
function verifyHas(source, items)
|
||||
local need = 0
|
||||
local have = 0
|
||||
local missingList = {}
|
||||
|
||||
------------------------------------------ logging stuff
|
||||
local logs = false
|
||||
local logapi = GetConvar("fivemerrLogs", "")
|
||||
local endpoint = 'https://api.fivemerr.com/v1/logs'
|
||||
local headers = {
|
||||
['Authorization'] = logapi,
|
||||
['Content-Type'] = 'application/json',
|
||||
}
|
||||
for k, v in pairs(items) do
|
||||
need = need + 1
|
||||
if ps.hasItem(source, k, v) then
|
||||
have = have + 1
|
||||
else
|
||||
local label = ps.getItemLabel(k) or k
|
||||
table.insert(missingList, v .. " " .. label)
|
||||
end
|
||||
end
|
||||
|
||||
if need == have then
|
||||
return true
|
||||
end
|
||||
|
||||
local message = ps.lang('Catches.itemMissings') .. table.concat(missingList, "\n")
|
||||
ps.notify(source, message, 'error')
|
||||
return false
|
||||
end
|
||||
|
||||
RegisterCommand('TestMissing', function(source)
|
||||
local items = {
|
||||
coke = 5,
|
||||
heroin = 2,
|
||||
lsd = 1
|
||||
}
|
||||
local src = source
|
||||
verifyHas(src, items)
|
||||
end)
|
||||
|
||||
local function handleFresh(source)
|
||||
local table = json.encode({
|
||||
@@ -68,66 +91,12 @@ function AddRep(source, type, amount)
|
||||
end
|
||||
end
|
||||
|
||||
lib.addCommand('addCornerSellingTOREP', {
|
||||
help = 'RUN THIS ONCE AND DELETE',
|
||||
restricted = 'group.admin'
|
||||
}, function(source, args, raw)
|
||||
local sql = MySQL.query.await('SELECT * FROM drugrep', {})
|
||||
for k, v in pairs (sql) do
|
||||
local new = {}
|
||||
local old = json.decode(v.drugrep)
|
||||
local get = old[1] or old
|
||||
table.insert(new, {
|
||||
coke = get.coke,
|
||||
lsd = get.lsd,
|
||||
heroin = get.heroin,
|
||||
dealerrep = get.dealerrep,
|
||||
cornerselling = {
|
||||
price = QBConfig.SellLevel[1].price,
|
||||
rep = 0,
|
||||
label = QBConfig.SellLevel[1].label,
|
||||
level = 1
|
||||
}
|
||||
})
|
||||
local news = json.encode(new)
|
||||
MySQL.query.await('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {news, v.cid})
|
||||
end
|
||||
end)
|
||||
|
||||
function sortTab(tbl, type)
|
||||
table.sort(tbl, function(a, b)
|
||||
return a[type] < b[type]
|
||||
end)
|
||||
end
|
||||
|
||||
function handleCornersell(source, item, amount, price)
|
||||
if RemoveItem(source, item, amount) then
|
||||
if inventory == 'qb' then
|
||||
local Player = getPlayer(source)
|
||||
if QBConfig.MarkedBills == true then
|
||||
Player.Functions.AddItem('markedbills',1,false, {worth = price})
|
||||
return true
|
||||
end
|
||||
if QBConfig.CustomDirtyMoney == true then
|
||||
AddItem(source, QBConfig.CustomDirtyMoneyitem,price)
|
||||
return true
|
||||
end
|
||||
Player.Functions.AddMoney('cash', price)
|
||||
elseif inventory == 'ox' then
|
||||
AddItem(source, 'black_money', price)
|
||||
return true
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||
return getCops()
|
||||
ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args)
|
||||
return ps.getJobTypeCount('leo')
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args)
|
||||
local rep = GetAllRep(source)
|
||||
local rep = GetAllRep(source)
|
||||
return rep
|
||||
end)
|
||||
|
||||
|
||||
+35
-19
@@ -59,8 +59,11 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:dryplant', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then return end
|
||||
if not ps.hasItem(src, 'poppyresin', 1) then return end
|
||||
if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
|
||||
local tier = 'tier1'
|
||||
if Config.TierSystem then
|
||||
local heroin = getRep(src, 'heroin')
|
||||
@@ -73,15 +76,17 @@ RegisterServerEvent('md-drugs:server:dryplant', function(num)
|
||||
end
|
||||
end
|
||||
if not ps.craftItem(src, heroinRecipes['dryheroin'][tier]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, heroinRecipes['dryheroin'][tier].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:cutheroin', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then return end
|
||||
if not ps.hasItem(src, 'bakingsoda', 1) then return end
|
||||
if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if Config.TierSystem then
|
||||
local itemList = {
|
||||
heroin = 'tier1',
|
||||
@@ -92,7 +97,7 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
|
||||
local cuth = ps.hasItem(src, k)
|
||||
if cuth then
|
||||
if not ps.craftItem(src, heroinRecipes['cutheroin'][v]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, heroinRecipes['cutheroin'][v].take)
|
||||
return
|
||||
end
|
||||
AddRep(src, 'heroin')
|
||||
@@ -101,7 +106,7 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
|
||||
end
|
||||
else
|
||||
if not ps.craftItem(src, heroinRecipes['cutheroin']['tier1']) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, heroinRecipes['cutheroin']['tier1'].take)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -109,13 +114,16 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
local has = ps.hasItem(src, 'heroinlabkit')
|
||||
if has then ps.notify(src, Lang.Heroin.haskit, 'error') return end
|
||||
if has then ps.notify(src, ps.lang('heroin.hasKitAlready'), 'error') return end
|
||||
if ps.removeMoney(src, 'cash', prices.heroinlabkitprice) then
|
||||
ps.addItem(src, 'heroinlabkit', 1)
|
||||
else
|
||||
ps.notify(src, 'You Need '.. prices.heroinlabkitprice .. ' In Cash For This', 'error')
|
||||
ps.notify(src, ps.lang('heroin.notEnoughMoney', prices.heroinlabkitprice), 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -152,7 +160,7 @@ ps.createUseable('heroinlabkit', function(source, item)
|
||||
coords = loc,
|
||||
name = ps.getPlayerName(src)
|
||||
})
|
||||
ps.notify(src, ps.lang('Heroin.placed'), "success")
|
||||
ps.notify(src, ps.lang('heroin.placedKit'), "success")
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -170,7 +178,7 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
|
||||
local cuth = ps.hasItem(src, k)
|
||||
if cuth then
|
||||
if not ps.craftItem(src, heroinRecipes['fillvial'][v]) then
|
||||
ps.notify(src, 'You do not have the required items', 'error')
|
||||
verifyHas(src, heroinRecipes['fillvial'][v].take)
|
||||
return
|
||||
end
|
||||
AddRep(src, 'heroin')
|
||||
@@ -178,7 +186,10 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
|
||||
end
|
||||
end
|
||||
else
|
||||
if not ps.craftItem(src, heroinRecipes['fillvial']['tier1']) then return end
|
||||
if not ps.craftItem(src, heroinRecipes['fillvial']['tier1']) then
|
||||
verifyHas(src, heroinRecipes['fillvial']['tier1'].take)
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -194,7 +205,7 @@ RegisterServerEvent('md-drugs:server:failheatingheroin', function()
|
||||
local cuth = ps.hasItem(src, k)
|
||||
if cuth then
|
||||
ps.removeItem(src, k, v)
|
||||
ps.notify(src, ps.lang('Heroin.fail'), "error")
|
||||
ps.notify(src, ps.lang('heroin.failed'), "error")
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -202,8 +213,8 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:fillneedle', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.fillneedle[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Heroin.noloc'), 'error')
|
||||
if not ps.checkDistance(src, heroinLocations.fillNeedle[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), 'error')
|
||||
return
|
||||
end
|
||||
if not ps.hasItem(src, 'needle', 1) then return end
|
||||
@@ -216,14 +227,19 @@ RegisterServerEvent('md-drugs:server:fillneedle', function(num)
|
||||
for k, v in pairs(itemList) do
|
||||
local vh = ps.hasItem(src, v.item)
|
||||
if vh then
|
||||
if not ps.craftItem(src, heroinRecipes['fillneedle'][v.tier]) then return end
|
||||
if not ps.craftItem(src, heroinRecipes['fillneedle'][v.tier]) then
|
||||
verifyHas(src, heroinRecipes['fillneedle'][v.tier].take)
|
||||
return
|
||||
end
|
||||
AddRep(src, 'heroin')
|
||||
return
|
||||
end
|
||||
end
|
||||
ps.notify(src,Lang.Heroin.nofill, "error")
|
||||
else
|
||||
if not ps.craftItem(src, heroinRecipes['fillneedle']['tier1']) then return end
|
||||
if not ps.craftItem(src, heroinRecipes['fillneedle']['tier1']) then
|
||||
verifyHas(src, heroinRecipes['fillneedle']['tier1'].take)
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ end
|
||||
RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
local src = source
|
||||
local amount = math.random(1,5)
|
||||
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end
|
||||
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('lean.notOnRun'), "error") end
|
||||
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1
|
||||
if math.random(1,100) <= 50 then
|
||||
ps.addItem(src, "mdlean", amount)
|
||||
|
||||
+17
-12
@@ -47,7 +47,7 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num)
|
||||
local src = source
|
||||
if timedOut[src] then return end
|
||||
if not ps.checkDistance(src, lsdLocations.lysergicacid[num].loc, 2.0) then
|
||||
ps.notify(src, ps.lang('lsd.notinloc'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
timeout(src, 3000)
|
||||
@@ -58,7 +58,7 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
|
||||
local src = source
|
||||
if timedOut[src] then return end
|
||||
if not ps.checkDistance(src, lsdLocations.diethylamide[num].loc, 2.0) then
|
||||
ps.notify(src, Lang.lsd.notinloc, "error")
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
timeout(src, 3000)
|
||||
@@ -109,7 +109,7 @@ RegisterServerEvent('md-drugs:server:heatliquid', function()
|
||||
local src = source
|
||||
if not hasLabKit(src) then return end
|
||||
if not ps.craftItem(src, lsdRecipes['vial']['heat']) then
|
||||
ps.notify(src, ps.lang('lsd.noliquid'), "error")
|
||||
verifyHas(src, lsdRecipes['vial']['heat'].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
@@ -119,14 +119,14 @@ RegisterServerEvent('md-drugs:server:failheating', function()
|
||||
if not hasLabKit(src) then return end
|
||||
ps.removeItem(src, 'lysergic_acid', 1)
|
||||
ps.removeItem(src, 'diethylamide', 1)
|
||||
ps.notify(src, ps.lang('prices.lsd.failed'), "error")
|
||||
ps.notify(src, ps.lang('lsd.failed'), "error")
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent('md-drugs:server:refinequalityacid', function()
|
||||
local src = source
|
||||
if not hasLabKit(src) then return end
|
||||
if not ps.hasItem(src, 'lsd_one_vial', 1) then return end
|
||||
local src = source
|
||||
if not hasLabKit(src) then return end
|
||||
if not ps.hasItem(src, 'lsd_one_vial', 1) then return end
|
||||
if Config.TierSystem then
|
||||
local lsd = getRep(src, 'lsd')
|
||||
if ps.removeItem(src, 'lsd_one_vial', 1) then
|
||||
@@ -170,25 +170,30 @@ end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if ps.removeMoney(src, 'cash', prices.tabcost * 10) then
|
||||
ps.addItem(src,'tab_paper', 10)
|
||||
else
|
||||
ps.notify(src, Lang.lsd.broke, "error")
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getlabkit', function(num)
|
||||
local src = source
|
||||
if ps.hasItem(src,'lsdlabkit', 1) then
|
||||
ps.notify(src, ps.lang('lsd.havlabkit'), 'error')
|
||||
return
|
||||
end
|
||||
if not ps.checkDistance(src, lsdLocations.buyLSDkit[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, lsdLocations.buyLSDkit[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if ps.removeMoney(src, 'cash', prices.lsdlabkitcost) then
|
||||
ps.addItem(src,'lsdlabkit', 1)
|
||||
else
|
||||
ps.notify(src, Lang.lsd.broke, "error")
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
+14
-4
@@ -3,23 +3,33 @@ local mescalineLocation = {
|
||||
{loc = vector3(1850.12, 2595.23, 45.67), l = 1.0, w = 1.0, rot = 0.0, gang = ""},
|
||||
},
|
||||
}
|
||||
local mescalineRecipes = {
|
||||
mescaline = {
|
||||
dry = {
|
||||
dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} }
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetMescalineLocs', function(source)
|
||||
return mescalineLocation
|
||||
end)
|
||||
|
||||
RegisterNetEvent("md-drugs:server:drymescaline", function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, mescalineLocation.DryOutMescaline[num].loc, 3.0) then
|
||||
ps.notify(src, "You are not in the right location", "error")
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not ps.craftItem(src, mescalineRecipes.mescaline.dry.dried) then
|
||||
verifyHas(src, mescalineRecipes.mescaline.dry.dried.take)
|
||||
return
|
||||
end
|
||||
if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end
|
||||
end)
|
||||
|
||||
ps.createUseable("driedmescaline", function(source, item)
|
||||
local src = source
|
||||
if ps.removeItem(src, "driedmescaline", 1) then
|
||||
if ps.removeItem(src, "driedmescaline", 1) then
|
||||
TriggerClientEvent("md-drugs:client:takemescaline", src)
|
||||
|
||||
end
|
||||
end)
|
||||
+39
-19
@@ -34,9 +34,19 @@ local methLocs = {
|
||||
}
|
||||
}
|
||||
|
||||
local methRecipes = {
|
||||
cook = {
|
||||
heat = {take = {ephedrine = 1, acetone = 1}, give = {}}
|
||||
},
|
||||
bag = {
|
||||
bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} }
|
||||
}
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetMethLocs', function(source)
|
||||
return methLocs
|
||||
end)
|
||||
|
||||
local function setTimeout(identifier)
|
||||
if onRun[identifier] then
|
||||
CreateThread(function()
|
||||
@@ -62,7 +72,7 @@ end
|
||||
RegisterServerEvent('md-drugs:server:givemethingridients', function()
|
||||
local src = source
|
||||
local amount = math.random(1,5)
|
||||
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, Lang.lean.err, "error") end
|
||||
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('meth.notOnRun'), "error") end
|
||||
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1
|
||||
if math.random(1,100) <= 50 then
|
||||
ps.addItem(src, "ephedrine", amount)
|
||||
@@ -74,41 +84,51 @@ RegisterServerEvent('md-drugs:server:givemethingridients', function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:startcook', function(num)
|
||||
local src = source
|
||||
if not GetRecipe(source, 'meth', 'cook', 'heat') then return end
|
||||
ps.notify(src, "Adding Things To The Mix", "success")
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getmeth', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then return end
|
||||
if not GetRecipe(src, 'meth', 'bag', 'bags') then return end
|
||||
if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not ps.craftItem(src, methRecipes.meth.bag.bags) then
|
||||
verifyHas(src, methRecipes.meth.bag.bags.take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:geteph', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, methLocs.MethEph[num].loc, 2.5) then return end
|
||||
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end
|
||||
if ps.addItem(src, 'ephedrine', 1) then
|
||||
ps.notify(src, 'Got Ephedrine!', "success")
|
||||
if not ps.checkDistance(src, methLocs.MethEph[num].loc, 2.5) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end
|
||||
ps.addItem(src, 'ephedrine', 1)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:getace', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, methLocs.MethAce[num].loc, 2.5) then return end
|
||||
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end
|
||||
if ps.addItem(src, 'acetone', 1) then
|
||||
ps.notify(src, 'Got Acetone!', "success")
|
||||
if not ps.checkDistance(src, methLocs.MethAce[num].loc, 2.5) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.onCooldown'), "error") end
|
||||
ps.addItem(src, 'acetone', 1)
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:startcook', function(source, num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, methLocs.CookMeth[num].loc, 2.5) then return false end
|
||||
local recipe = GetRecipe(src, 'meth', 'cook', 'heat')
|
||||
return recipe
|
||||
if not ps.checkDistance(src, methLocs.CookMeth[num].loc, 2.5) then
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return false
|
||||
end
|
||||
local recipe = ps.craftItem(src, methRecipes.meth.cook.heat)
|
||||
if not recipe then
|
||||
verifyHas(src, methRecipes.meth.cook.heat.take)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:registerMeth', function(source)
|
||||
|
||||
+4
-4
@@ -32,10 +32,10 @@ ps.registerCallback('md-drugs:server:payfortruck', function(source)
|
||||
local src = source
|
||||
if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then
|
||||
onRoute[src] = true
|
||||
ps.notify(src, ps.lang('oxy.paid') .. prices.payfortruck, "success")
|
||||
ps.notify(src, ps.lang('oxy.paid', prices.payfortruck), "success")
|
||||
return true
|
||||
else
|
||||
ps.notify(src, ps.lang('oxy.broke'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
return false
|
||||
end
|
||||
end)
|
||||
@@ -44,12 +44,12 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:giveoxybox', function()
|
||||
local src = source
|
||||
if not onRoute[src] then
|
||||
ps.notify(src, ps.lang('oxy.notonroute'), "error")
|
||||
ps.notify(src, ps.lang('oxy.notOn'), "error")
|
||||
return
|
||||
end
|
||||
|
||||
if not ps.checkDistance(src, oxyLocs.oxylocations[onRoute[src]], 3.5) then
|
||||
ps.notify(src, ps.lang('oxy.toofar'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
+8
-8
@@ -7,6 +7,7 @@ local pharmaLocations = {
|
||||
ps.registerCallback('md-drugs:server:GetPharmaLocs', function()
|
||||
return pharmaLocations
|
||||
end)
|
||||
|
||||
local function GetJob(source)
|
||||
local src = source
|
||||
return ps.getJobType(src) == 'ems'
|
||||
@@ -17,15 +18,14 @@ ps.createUseable('prescription_pad', function(source, item)
|
||||
local near = {}
|
||||
if GetJob(src) then
|
||||
near = ps.getNearbyPlayers(src, 5.0)
|
||||
|
||||
local options = {
|
||||
{label = 'Vicodin', value = 'vicodin_prescription'},
|
||||
{label = 'Adderal', value = 'adderal_prescription'},
|
||||
{label = 'Morphine', value = 'morphine_prescription'},
|
||||
{label = 'Xanax', value = 'xanax_prescription'}
|
||||
{label = ps.getItemLabel('vicodin_prescription'), value = 'vicodin_prescription'},
|
||||
{label = ps.getItemLabel('adderal_prescription'), value = 'adderal_prescription'},
|
||||
{label = ps.getItemLabel('morphine_prescription'), value = 'morphine_prescription'},
|
||||
{label = ps.getItemLabel('xanax_prescription'), value = 'xanax_prescription'}
|
||||
}
|
||||
local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options)
|
||||
if not data then return ps.notify(src, ps.lang('Pharma.cancel'), "error") end
|
||||
if not data then return ps.notify(src, ps.lang('pharma.canceled'), "error") end
|
||||
ps.addItem(ps.getSource(data.who), data.what, 1)
|
||||
end
|
||||
end)
|
||||
@@ -46,7 +46,7 @@ for m, d in pairs (pharmabottle) do
|
||||
if d == k then
|
||||
if ps.removeItem(src, d, 1) then
|
||||
ps.addItem(src, v, math.random(10,30))
|
||||
ps.notify(src,ps.lang('Pharma.unbottle'), "success")
|
||||
ps.notify(src,ps.lang('pharma.unbottle'), "success")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -57,7 +57,7 @@ end
|
||||
RegisterServerEvent('md-drugs:server:fillprescription', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then
|
||||
return ps.notify(src, ps.lang('Pharma.toofar'), "error")
|
||||
return ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
end
|
||||
local pres = {
|
||||
vicodin_prescription = 'vicodinbottle',
|
||||
|
||||
@@ -12,7 +12,7 @@ local drugModelsBuzz = {
|
||||
weed = "bzzz_plant_weed_pot_green_d"
|
||||
}
|
||||
local function propsLabels(drugType)
|
||||
if Config.Buzz[drugType] then
|
||||
if Config.Bzz[drugType] then
|
||||
return drugModelsBuzz[drugType]
|
||||
else
|
||||
return drugModels[drugType]
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
|
||||
recipe = {
|
||||
mescaline = {
|
||||
dry = {
|
||||
dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} }
|
||||
}
|
||||
},
|
||||
lean = {
|
||||
cups = {
|
||||
cupoflean = {take = {leancup = 1, sprunk = 1, mdlean = 1}, give = {cupoflean = 1}},
|
||||
cupofdextro = {take = {leancup = 1, sprunk = 1, mdreddextro = 1}, give = {cupofdextro = 1}},
|
||||
}
|
||||
},
|
||||
meth = {
|
||||
cook = {
|
||||
heat = {take = {ephedrine = 1, acetone = 1}, give = {}}
|
||||
},
|
||||
bag = {
|
||||
bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} }
|
||||
}
|
||||
},
|
||||
weed = {
|
||||
oil = {
|
||||
shatter = {take = {butane = 1, grindedweed = 1}, give = {shatter = 1}}
|
||||
},
|
||||
blunts = {
|
||||
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
||||
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
||||
leanblunts = {take = {leanbluntwrap = 1, grindedweed = 1}, give = {leanblunts = 1}},
|
||||
dextroblunts = {take = {dextrobluntwrap = 1, grindedweed = 1}, give = {dextroblunts = 1}}
|
||||
},
|
||||
bluntwrap = {
|
||||
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
||||
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function GetRecipe(source, type, method, tier)
|
||||
return ps.craftItem(source, recipe[type][method][tier])
|
||||
end
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetRecipe', function(source, type, cat)
|
||||
if not source then return false end
|
||||
return recipe[type][cat]
|
||||
end)
|
||||
|
||||
function craft(source, tbl, item)
|
||||
local src = source
|
||||
local need, have = 0,0
|
||||
for k, v in pairs(tbl.take) do
|
||||
if ps.hasItem(src, k, v) then
|
||||
have = have + v
|
||||
end
|
||||
need = need + v
|
||||
end
|
||||
if need == have then
|
||||
for k, v in pairs (tbl.take) do
|
||||
ps.removeItem(src, k, v)
|
||||
end
|
||||
ps.addItem(src, item , tbl.amount)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
local Target = {
|
||||
Travellingmerchant = { -- where the travelling merchant can spawn
|
||||
vector4(-119.66, -977.43, 304.25, 88.21),
|
||||
vector4(-1522.93, 1476.01, 111.45, 41.25),
|
||||
vector4(-3278.98, 973.38, 5.35, 101.53),
|
||||
},
|
||||
}
|
||||
|
||||
local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)]
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetMerchant', function(source)
|
||||
return loc
|
||||
end)
|
||||
|
||||
function getRandW(src)
|
||||
local rand = math.random(1, #Target.oxylocations)
|
||||
return Target.oxylocations[rand]
|
||||
end
|
||||
|
||||
local stores = {
|
||||
travel = {
|
||||
{name = "tab_paper", price = 50, amount = 50, },
|
||||
{name = "bakingsoda", price = 25, amount = 50, },
|
||||
{name = "isosafrole", price = 25, amount = 50, },
|
||||
{name = "mdp2p", price = 25, amount = 50, },
|
||||
{name = "lysergic_acid", price = 25, amount = 50, },
|
||||
{name = "diethylamide", price = 25, amount = 50, },
|
||||
{name = "lockpick", price = 2, amount = 1000, },
|
||||
{name = "emptyvial", price = 2, amount = 1000, },
|
||||
{name = "needle", price = 2, amount = 1000, },
|
||||
{name = "cokeburner", price = 25, amount = 50, },
|
||||
{name = "crackburner", price = 2, amount = 50, },
|
||||
{name = "lsdburner", price = 2, amount = 50, },
|
||||
{name = "heroinburner", price = 2, amount = 50, },
|
||||
{name = "mdlean", price = 50, amount = 50, },
|
||||
{name = "weedgrinder", price = 25, amount = 50, },
|
||||
{name = "mdbutter", price = 25, amount = 50, },
|
||||
{name = "flour", price = 25, amount = 50, },
|
||||
{name = "chocolate", price = 25, amount = 50, },
|
||||
{name = "butane", price = 25, amount = 50, },
|
||||
{name = "butanetorch", price = 2, amount = 1000, },
|
||||
{name = "dabrig", price = 2, amount = 1000, },
|
||||
{name = "mdwoods", price = 2, amount = 1000, },
|
||||
{name = "leancup", price = 25, amount = 50, },
|
||||
{name = "xtcburner", price = 25, amount = 50, },
|
||||
},
|
||||
|
||||
Products = {
|
||||
{name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
|
||||
},
|
||||
ProductsStupidNameRewrite = {
|
||||
{name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0},
|
||||
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
|
||||
}
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:menu', function(source, data)
|
||||
local src = source
|
||||
if data == 'travellingMerchant' then
|
||||
return {table = stores.travel, des = '$', id = 'travellingMerchant', title = 'travelling Merchant'}
|
||||
elseif data == 'dealermenu' then
|
||||
local table
|
||||
if Config.StupidassNewQbItemName then table = stores.ProductsStupidNameRewrite else table = stores.Products end
|
||||
return {table = table, id = 'dealermenu', title = "Dealer Menu"}
|
||||
elseif data == 'WeedShop' then
|
||||
return {table = stores.Weed, id = 'WeedShop', title = "Weed Shop"}
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num)
|
||||
local src = source local Player = getPlayer(src)
|
||||
for i = 1, #table do
|
||||
if table[i].name == item then
|
||||
if not table[i].price == price then return end
|
||||
if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then
|
||||
AddItem(src, item, amount)
|
||||
--Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
ps.createUseable('shrooms', function(source, item)
|
||||
local src = source
|
||||
if not ps.callback("md-drugs:client:shrooms", src) then
|
||||
ps.notify(src, ps.lang('Shrooms.cancel'), "error")
|
||||
ps.notify(src, ps.lang('shrooms.cancel'), "error")
|
||||
return
|
||||
end
|
||||
ps.removeItem(src, 'shrooms', 1)
|
||||
ps.notify(src, 'You Took Some Shrooms!', 'success')
|
||||
ps.notify(src, ps.lang('shrooms.took'), 'success')
|
||||
end)
|
||||
|
||||
+31
-9
@@ -30,6 +30,24 @@ local weedStore = {
|
||||
mdwoods =2,
|
||||
}
|
||||
|
||||
local weed = {
|
||||
blunts = {
|
||||
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
|
||||
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
|
||||
leanblunts = {take = {leanbluntwrap = 1, grindedweed = 1}, give = {leanblunts = 1}},
|
||||
dextroblunts = {take = {dextrobluntwrap = 1, grindedweed = 1}, give = {dextroblunts = 1}}
|
||||
},
|
||||
bluntwrap = {
|
||||
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
|
||||
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
|
||||
}
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetWeedRecipe', function(source, tableName)
|
||||
if not source then return false end
|
||||
return weed[tableName]
|
||||
end)
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetWeedLocs', function(source)
|
||||
return weedLocs
|
||||
end)
|
||||
@@ -37,20 +55,21 @@ end)
|
||||
ps.registerCallback('md-drugs:server:getWeedItems', function(source)
|
||||
return weedStore
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then
|
||||
ps.notify(src, ps.lang('Weed.notHere'), "error")
|
||||
ps.notify(src, ps.lang('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if not weedStore[name] then
|
||||
ps.notify(src, ps.lang('Weed.notHere'), "error")
|
||||
ps.notify(src, ps.lang('weed.itemDoesntExist'), "error")
|
||||
return
|
||||
end
|
||||
if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then
|
||||
ps.addItem(src, name, amount)
|
||||
else
|
||||
ps.notify(src, ps.lang('Weed.noMoney'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -59,12 +78,12 @@ RegisterServerEvent('md-drugs:server:dryoutweed', function()
|
||||
if ps.removeItem(src,"wetcannabis", 1) then
|
||||
ps.addItem(src,"drycannabis", 1)
|
||||
else
|
||||
ps.notify(src, ps.lang('Weed.nodry'), "error")
|
||||
ps.notify(src, ps.lang('weed.noDry'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
local bluntwrap = {'mdreddextro','mdlean'}
|
||||
for k, v in pairs (bluntwrap) do
|
||||
for k, v in pairs (bluntwrap) do
|
||||
ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
|
||||
end
|
||||
|
||||
@@ -77,7 +96,10 @@ end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
|
||||
local src = source
|
||||
if not GetRecipe(src, data.recipe, data.table, data.item) then return end
|
||||
if not ps.craftItem(src, weed[data.table][data.item]) then
|
||||
verifyHas(src, weed[data.table][data.item].take)
|
||||
return
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -88,13 +110,13 @@ ps.createUseable("dabrig", function(source, item)
|
||||
TriggerClientEvent("md-drugs:client:dodabs", src)
|
||||
end
|
||||
else
|
||||
ps.notify(src, 'You Need A Butane Torch', 'error')
|
||||
ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("butanetorch")), 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
ps.createUseable("weedgrinder", function(source, item)
|
||||
local src = source
|
||||
if not ps.hasItem(src, "drycannabis") then ps.notify(src, 'You Need Dried Cannabis', 'error') return end
|
||||
if not ps.hasItem(src, "drycannabis") then ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("drycannabis")), 'error') return end
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed')
|
||||
if not check then return end
|
||||
if ps.removeItem(src, "drycannabis",1 ) then
|
||||
@@ -104,7 +126,7 @@ end)
|
||||
|
||||
ps.createUseable("mdwoods", function(source, item)
|
||||
local src = source
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, 'Breaking Blunt Open')
|
||||
local check = ps.callback('md-drugs:client:uncuff', src, ps.lang('weed.crackBlunt'))
|
||||
if not check then return end
|
||||
if ps.removeItem(src, "mdwoods",1 ) then
|
||||
ps.addItem(src, "bluntwrap", 5)
|
||||
|
||||
+35
-14
@@ -14,15 +14,33 @@ local Price = {
|
||||
heroin = {min = 20, max = 60},
|
||||
xtc = {min = 20, max = 60},
|
||||
}
|
||||
local locs = {
|
||||
vector4(-2352.32, 266.78, 165.3, 23.46),
|
||||
vector4(-1467.49, 874.01, 183.59, 298.45),
|
||||
vector4(-856.71, 874.26, 202.85, 205.3),
|
||||
vector4(950.58, -128.49, 74.42, 205.3),
|
||||
vector4(1152.71, -328.43, 69.21, 205.3),
|
||||
vector4(112.66, -1955.67, 20.75, 37.94),
|
||||
vector4(-544.4, -1684.8, 19.89, 252.07),
|
||||
vector4(-1185.02, -1805.4, 3.91, 184.83),
|
||||
vector4(-1641.4, -981.99, 7.58, 35.38),
|
||||
vector4(-1827.93, 782.36, 138.29, 219.99),
|
||||
vector4(-320.84, 2818.73, 59.45, 337.22),
|
||||
vector4(474.88, 2609.56, 44.48, 357.0),
|
||||
}
|
||||
function getRandW(src)
|
||||
local rand = math.random(1, #locs)
|
||||
return locs[rand]
|
||||
end
|
||||
|
||||
for k, v in pairs (burners) do
|
||||
CUI(k, function(source, item)
|
||||
ps.createUseable(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if getCops() < Config.PoliceCount then return ps.notify(src, Lang.Wholesale.na, 'error') end
|
||||
if getCops() < Config.PoliceCount then return ps.notify(src, ps.lang('wholesale.notEnoughCops'), 'error') end
|
||||
for m, d in pairs (active) do
|
||||
if d.cid == Player.PlayerData.citizenid then
|
||||
return ps.notify(src, Lang.Wholesale.al, 'error' )
|
||||
return ps.notify(src, ps.lang('wholesale.alreadyWholesale'), 'error' )
|
||||
end
|
||||
end
|
||||
local tab = ''
|
||||
@@ -31,17 +49,17 @@ for k, v in pairs (burners) do
|
||||
if k == 'lsdburner' then tab = 'lsd' end
|
||||
if k == 'heroinburner' then tab = 'heroin' end
|
||||
if k == 'xtcburner' then tab = 'xtc' end
|
||||
if RemoveItem(src, k, 1) then
|
||||
if ps.removeItem(src, k, 1) then
|
||||
table.insert(active, {
|
||||
src = src,
|
||||
item = k,
|
||||
location = getRandW(src),
|
||||
cid = Player.PlayerData.citizenid,
|
||||
cid = ps.getIdentifier(src),
|
||||
type = v,
|
||||
price = Price[tab]
|
||||
})
|
||||
for m, d in pairs (active) do
|
||||
if d.cid == Player.PlayerData.citizenid then
|
||||
if d.cid == ps.getIdentifier(src) then
|
||||
TriggerClientEvent("md-drugs:client:GetLocation", src, active[m])
|
||||
end
|
||||
end
|
||||
@@ -51,15 +69,18 @@ end
|
||||
|
||||
RegisterNetEvent('md-drugs:server:SuccessSale', function(data)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
for k, v in pairs (active) do
|
||||
if v.cid == Player.PlayerData.citizenid then
|
||||
for k, v in pairs (active) do
|
||||
if v.cid == ps.getIdentifier(src) then
|
||||
if not ps.checkDistance(src, v.location, 4.0) then
|
||||
return ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
end
|
||||
local payout = math.random(v.price.min, v.price.max)
|
||||
for m, d in pairs (v.type) do
|
||||
local git = Player.Functions.GetItemByName(d)
|
||||
if git and git.amount >= 1 then
|
||||
RemoveItem(src, d, git.amount)
|
||||
Player.Functions.AddMoney('cash', git.amount * payout)
|
||||
for m, d in pairs (v.type) do
|
||||
local git = ps.getItemCount(src, d)
|
||||
if git >= 1 then
|
||||
if ps.removeItem(src, d, git) then
|
||||
ps.addMoney('cash', git * payout)
|
||||
end
|
||||
end
|
||||
table.remove(active, k)
|
||||
end
|
||||
|
||||
+42
-14
@@ -53,9 +53,30 @@ local xtcLocations = {
|
||||
{loc = vector3(844.71, -900.56, 25.43), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
|
||||
},
|
||||
}
|
||||
|
||||
ps.registerCallback('md-drugs:server:GetXtcLocs', function(source)
|
||||
return xtcLocations
|
||||
end)
|
||||
|
||||
local function craft(source, tbl, item)
|
||||
local src = source
|
||||
local need, have = 0,0
|
||||
for k, v in pairs(tbl.take) do
|
||||
if ps.hasItem(src, k, v) then
|
||||
have = have + v
|
||||
end
|
||||
need = need + v
|
||||
end
|
||||
if need == have then
|
||||
for k, v in pairs (tbl.take) do
|
||||
ps.removeItem(src, k, v)
|
||||
end
|
||||
ps.addItem(src, item , tbl.amount)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local activePresses = {}
|
||||
local timeout = {}
|
||||
|
||||
@@ -69,20 +90,26 @@ end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if timeout[ps.getIdentifier(src)] then
|
||||
ps.notify(src, 'You are still waiting for the last minigame to finish', 'error')
|
||||
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
|
||||
return
|
||||
end
|
||||
timeOut(src)
|
||||
ps.addItem(src, "isosafrole", 1)
|
||||
ps.addItem(src, "isosafrole", 1)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if timeout[ps.getIdentifier(src)] then
|
||||
ps.notify(src, 'You are still waiting for the last minigame to finish', 'error')
|
||||
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
|
||||
return
|
||||
end
|
||||
timeOut(src)
|
||||
@@ -126,7 +153,7 @@ end)
|
||||
RegisterServerEvent('md-drugs:server:makextc', function(data)
|
||||
local src = source
|
||||
if not activePresses[ps.getIdentifier(src)] then
|
||||
ps.notify(src, 'You Dont Have A Pill Press', 'error')
|
||||
ps.notify(src, ps.lang('xtc.noPressOut'), 'error')
|
||||
return
|
||||
end
|
||||
craft(src, RecipeList[activePresses[ps.getIdentifier(src)].press][data], data)
|
||||
@@ -137,14 +164,14 @@ RegisterServerEvent('md-drugs:server:buypress', function()
|
||||
if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then
|
||||
ps.addItem(src, "singlepress", 1)
|
||||
else
|
||||
ps.notify(ps.lang('xtc.cash'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error")
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('md-drugs:server:upgradepress', function(data)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then
|
||||
ps.notify(src, ps.lang('xtc.toofar'), "error")
|
||||
ps.notify(src, ps.lang('Catches.notIn'), "error")
|
||||
return
|
||||
end
|
||||
craft(src, RecipeList.presses[data], data)
|
||||
@@ -156,9 +183,12 @@ end)
|
||||
------------- making powder
|
||||
RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
|
||||
local src = source
|
||||
if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then return end
|
||||
if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then
|
||||
ps.notify(src, ps.lang('Checks.notIn'), "error")
|
||||
return
|
||||
end
|
||||
if timeout[ps.getIdentifier(src)] then
|
||||
ps.notify(src, 'You are still waiting for the last minigame to finish', 'error')
|
||||
ps.notify(src, ps.lang('Catches.cooldown'), 'error')
|
||||
return
|
||||
end
|
||||
timeOut(src)
|
||||
@@ -174,10 +204,8 @@ local function getColor(color)
|
||||
}
|
||||
if colors[color] then
|
||||
return colors[color][math.random(#colors[color])]
|
||||
else
|
||||
ps.notify('Invalid color specified', 'error')
|
||||
return nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:stamp', function(num, color)
|
||||
@@ -199,7 +227,7 @@ RegisterServerEvent('md-drugs:server:stamp', function(num, color)
|
||||
elseif ps.removeItem(src, colors[color].."4", 1) then
|
||||
ps.addItem(src, item..'4', 1)
|
||||
else
|
||||
ps.notify('You Dont Have Unstamped '..color..' Pills', 'error')
|
||||
ps.notify(src, ps.lang('xtc.noPills'), 'error')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in new issue
Block a user