mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Fixed exploiting zones, closes #25
This commit is contained in:
+85
-51
@@ -58,11 +58,14 @@ RegisterServerEvent('esx_drugs:startHarvestCoke')
|
|||||||
AddEventHandler('esx_drugs:startHarvestCoke', function()
|
AddEventHandler('esx_drugs:startHarvestCoke', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersHarvestingCoke[_source] = true
|
if not PlayersHarvestingCoke[_source] then
|
||||||
|
PlayersHarvestingCoke[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||||
|
HarvestCoke(_source)
|
||||||
HarvestCoke(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopHarvestCoke')
|
RegisterServerEvent('esx_drugs:stopHarvestCoke')
|
||||||
@@ -102,11 +105,14 @@ RegisterServerEvent('esx_drugs:startTransformCoke')
|
|||||||
AddEventHandler('esx_drugs:startTransformCoke', function()
|
AddEventHandler('esx_drugs:startTransformCoke', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersTransformingCoke[_source] = true
|
if not PlayersTransformingCoke[_source] then
|
||||||
|
PlayersTransformingCoke[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||||
|
TransformCoke(_source)
|
||||||
TransformCoke(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopTransformCoke')
|
RegisterServerEvent('esx_drugs:stopTransformCoke')
|
||||||
@@ -161,11 +167,14 @@ RegisterServerEvent('esx_drugs:startSellCoke')
|
|||||||
AddEventHandler('esx_drugs:startSellCoke', function()
|
AddEventHandler('esx_drugs:startSellCoke', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersSellingCoke[_source] = true
|
if not PlayersSellingCoke[_source] then
|
||||||
|
PlayersSellingCoke[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||||
|
SellCoke(_source)
|
||||||
SellCoke(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopSellCoke')
|
RegisterServerEvent('esx_drugs:stopSellCoke')
|
||||||
@@ -201,11 +210,14 @@ RegisterServerEvent('esx_drugs:startHarvestMeth')
|
|||||||
AddEventHandler('esx_drugs:startHarvestMeth', function()
|
AddEventHandler('esx_drugs:startHarvestMeth', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersHarvestingMeth[_source] = true
|
if not PlayersHarvestingMeth[_source] then
|
||||||
|
PlayersHarvestingMeth[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||||
|
HarvestMeth(_source)
|
||||||
HarvestMeth(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopHarvestMeth')
|
RegisterServerEvent('esx_drugs:stopHarvestMeth')
|
||||||
@@ -245,11 +257,14 @@ RegisterServerEvent('esx_drugs:startTransformMeth')
|
|||||||
AddEventHandler('esx_drugs:startTransformMeth', function()
|
AddEventHandler('esx_drugs:startTransformMeth', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersTransformingMeth[_source] = true
|
if not PlayersTransformingMeth[_source] then
|
||||||
|
PlayersTransformingMeth[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||||
|
TransformMeth(_source)
|
||||||
TransformMeth(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopTransformMeth')
|
RegisterServerEvent('esx_drugs:stopTransformMeth')
|
||||||
@@ -307,11 +322,14 @@ RegisterServerEvent('esx_drugs:startSellMeth')
|
|||||||
AddEventHandler('esx_drugs:startSellMeth', function()
|
AddEventHandler('esx_drugs:startSellMeth', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersSellingMeth[_source] = true
|
if not PlayersSellingMeth[_source] then
|
||||||
|
PlayersSellingMeth[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||||
|
SellMeth(_source)
|
||||||
SellMeth(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopSellMeth')
|
RegisterServerEvent('esx_drugs:stopSellMeth')
|
||||||
@@ -329,7 +347,7 @@ local function HarvestWeed(source)
|
|||||||
end
|
end
|
||||||
|
|
||||||
SetTimeout(Config.TimeToFarm, function()
|
SetTimeout(Config.TimeToFarm, function()
|
||||||
if PlayersHarvestingWeed[source] == true then
|
if PlayersHarvestingWeed[source] then
|
||||||
local _source = source
|
local _source = source
|
||||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||||
local weed = xPlayer.getInventoryItem('weed')
|
local weed = xPlayer.getInventoryItem('weed')
|
||||||
@@ -348,11 +366,14 @@ RegisterServerEvent('esx_drugs:startHarvestWeed')
|
|||||||
AddEventHandler('esx_drugs:startHarvestWeed', function()
|
AddEventHandler('esx_drugs:startHarvestWeed', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersHarvestingWeed[_source] = true
|
if not PlayersHarvestingWeed[_source] then
|
||||||
|
PlayersHarvestingWeed[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||||
|
HarvestWeed(_source)
|
||||||
HarvestWeed(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopHarvestWeed')
|
RegisterServerEvent('esx_drugs:stopHarvestWeed')
|
||||||
@@ -393,11 +414,14 @@ RegisterServerEvent('esx_drugs:startTransformWeed')
|
|||||||
AddEventHandler('esx_drugs:startTransformWeed', function()
|
AddEventHandler('esx_drugs:startTransformWeed', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersTransformingWeed[_source] = true
|
if not PlayersTransformingWeed[_source] then
|
||||||
|
PlayersTransformingWeed[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||||
|
TransformWeed(_source)
|
||||||
TransformWeed(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopTransformWeed')
|
RegisterServerEvent('esx_drugs:stopTransformWeed')
|
||||||
@@ -450,11 +474,14 @@ RegisterServerEvent('esx_drugs:startSellWeed')
|
|||||||
AddEventHandler('esx_drugs:startSellWeed', function()
|
AddEventHandler('esx_drugs:startSellWeed', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersSellingWeed[_source] = true
|
if not PlayersSellingWeed[_source] then
|
||||||
|
PlayersSellingWeed[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||||
|
SellWeed(_source)
|
||||||
SellWeed(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopSellWeed')
|
RegisterServerEvent('esx_drugs:stopSellWeed')
|
||||||
@@ -464,9 +491,7 @@ AddEventHandler('esx_drugs:stopSellWeed', function()
|
|||||||
PlayersSellingWeed[_source] = false
|
PlayersSellingWeed[_source] = false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
--opium
|
--opium
|
||||||
|
|
||||||
local function HarvestOpium(source)
|
local function HarvestOpium(source)
|
||||||
if CopsConnected < Config.RequiredCopsOpium then
|
if CopsConnected < Config.RequiredCopsOpium then
|
||||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium))
|
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium))
|
||||||
@@ -493,11 +518,14 @@ RegisterServerEvent('esx_drugs:startHarvestOpium')
|
|||||||
AddEventHandler('esx_drugs:startHarvestOpium', function()
|
AddEventHandler('esx_drugs:startHarvestOpium', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersHarvestingOpium[_source] = true
|
if not PlayersHarvestingOpium[_source] then
|
||||||
|
PlayersHarvestingOpium[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||||
|
HarvestOpium(_source)
|
||||||
HarvestOpium(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopHarvestOpium')
|
RegisterServerEvent('esx_drugs:stopHarvestOpium')
|
||||||
@@ -539,11 +567,14 @@ RegisterServerEvent('esx_drugs:startTransformOpium')
|
|||||||
AddEventHandler('esx_drugs:startTransformOpium', function()
|
AddEventHandler('esx_drugs:startTransformOpium', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersTransformingOpium[_source] = true
|
if not PlayersTransformingOpium[_source] then
|
||||||
|
PlayersTransformingOpium[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||||
|
TransformOpium(_source)
|
||||||
TransformOpium(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopTransformOpium')
|
RegisterServerEvent('esx_drugs:stopTransformOpium')
|
||||||
@@ -599,11 +630,14 @@ RegisterServerEvent('esx_drugs:startSellOpium')
|
|||||||
AddEventHandler('esx_drugs:startSellOpium', function()
|
AddEventHandler('esx_drugs:startSellOpium', function()
|
||||||
local _source = source
|
local _source = source
|
||||||
|
|
||||||
PlayersSellingOpium[_source] = true
|
if not PlayersSellingOpium[_source] then
|
||||||
|
PlayersSellingOpium[_source] = true
|
||||||
|
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||||
|
SellOpium(_source)
|
||||||
SellOpium(_source)
|
else
|
||||||
|
print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1]))
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent('esx_drugs:stopSellOpium')
|
RegisterServerEvent('esx_drugs:stopSellOpium')
|
||||||
|
|||||||
Reference in New Issue
Block a user