Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Black Garage
PawnShop no more buy car
Add 2 Black Garage to buy stoled car
  • Loading branch information
RedAlex committed Apr 5, 2019
1 parent fa509e4 commit a618280
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 29 deletions.
84 changes: 56 additions & 28 deletions client/main.lua
Expand Up @@ -275,23 +275,12 @@ function OpenPawnshopMenu()
local playerPed = PlayerPedId()
local veh = GetVehiclePedIsIn(playerPed, false)

for i=1, #Config.PawnShopBLJob, 1 do
local BLJob = Config.PawnShopBLJob[i]
if PlayerData.job.name == BLJob.JobName then
cantsellcar = true
end
end

local menuelements = {
{label = _U('pawnshop_buyitem'), value = 'pawnshop_buyitem'},
{label = _U('pawnshop_rebuy'), value = 'pawnshop_rebuy'}

}

if not cantsellcar and GetPedInVehicleSeat(veh, -1) == playerPed then
table.insert(menuelements, {label = _U('pawnshop_resell'), value = 'pawnshop_resell'})
end

ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'pawnshop',
{
Expand All @@ -302,9 +291,7 @@ function OpenPawnshopMenu()
menu.close()
local zone = Config.Zones
for i=1, #zone, 1 do
if (isNear(zone[i].Pos)) and data.current.value == 'pawnshop_resell' then
SellStolenCar()
elseif (isNear(zone[i].Pos)) and data.current.value == 'pawnshop_rebuy' then
if (isNear(zone[i].Pos)) and data.current.value == 'pawnshop_rebuy' then
OpenPawnshopMenu3()
elseif (isNear(zone[i].Pos)) and data.current.value == 'pawnshop_buyitem' then
OpenPawnshopMenu2()
Expand All @@ -317,6 +304,43 @@ function OpenPawnshopMenu()
)
end

function OpenBlackGarageMenu()
ESX.UI.Menu.CloseAll()

local cantsellcar = false
local playerPed = PlayerPedId()
local veh = GetVehiclePedIsIn(playerPed, false)

for i=1, #Config.PawnShopBLJob, 1 do
local BLJob = Config.PawnShopBLJob[i]
if PlayerData.job.name == BLJob.JobName then
cantsellcar = true
end
end

if not cantsellcar and GetPedInVehicleSeat(veh, -1) == playerPed then
local menuelements = {{label = _U('pawnshop_resell'), value = 'pawnshop_resell'}}

ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'blackgarage',
{
title = _U('black_menu_title'),
align = 'left',
elements = menuelements,
}, function(data, menu)
menu.close()
local zone = Config.Zones
for i=1, #zone, 1 do
if (isNear(zone[i].Pos)) and data.current.value == 'pawnshop_resell' then
SellStolenCar()
end
end
end, function(data, menu)
menu.close()
end)
end
end

function SellStolenCar()
local playerPed = PlayerPedId()
local veh = GetVehiclePedIsIn(playerPed, false)
Expand Down Expand Up @@ -535,19 +559,19 @@ end
Citizen.CreateThread(function()
local zone = Config.Zones
for i=1, #zone, 1 do
local blip = AddBlipForCoord(zone[i].Pos.x, zone[i].Pos.y, zone[i].z)
SetBlipSprite (blip, 488)
SetBlipDisplay(blip, 4)
SetBlipColour (blip, 1)
SetBlipScale (blip, 1.2)
SetBlipAsShortRange(blip, true)

BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('pawn_shop_blip'))
EndTextCommandSetBlipName(blip)

if zone[i].OnMap then
local blip = AddBlipForCoord(zone[i].Pos.x, zone[i].Pos.y, zone[i].z)
SetBlipSprite (blip, 488)
SetBlipDisplay(blip, 4)
SetBlipColour (blip, 1)
SetBlipScale (blip, 1.2)
SetBlipAsShortRange(blip, true)

BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('pawn_shop_blip'))
EndTextCommandSetBlipName(blip)
end
end

while true do
Citizen.Wait(0)
for i=1, #zone, 1 do
Expand All @@ -557,12 +581,16 @@ local zone = Config.Zones
if(isNear(zone[i].Pos)) and (zone[i].Name) == "PawnShop" then
Info(_U('pawn_shop_menu'))
if(IsControlJustPressed(1, 38)) then
OpenPawnshopMenu()
OpenPawnshopMenu()
end
elseif(isNear(zone[i].Pos)) and (zone[i].Name) == "BlackGarage" then
Info(_U('black_garage_menu'))
if(IsControlJustPressed(1, 38)) then
OpenBlackGarageMenu()
end
end
end

end

end)

19 changes: 19 additions & 0 deletions config.lua
Expand Up @@ -40,23 +40,42 @@ Config.Zones = {

{
Name = "PawnShop",
OnMap = true, --if set true PawnShop will be show on map
Pos = {x = -1451.63, y = -382.51 , z = 38.36 },
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
},
{
Name = "PawnShop",
OnMap = true, --if set true PawnShop will be show on map
Pos = {x = 1708.82, y = 3774.66 , z = 34.49 },
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
},
{
Name = "PawnShop",
OnMap = true, --if set true PawnShop will be show on map
Pos = {x = -230.73, y = 6351.28 , z = 32.20 },
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
},
{
Name = "BlackGarage",
OnMap = false, --if set true BlackGarage will be show on map
Pos = {x = 1218.43, y = -3230.96 , z = 4.16 },
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
},
{
Name = "BlackGarage",
OnMap = false, --if set true BlackGarage will be show on map
Pos = {x = 2352.38, y = 3133.29 , z = 47.71 },
Size = {x = 1.5, y = 1.5, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Type = 1
}
}
4 changes: 3 additions & 1 deletion locales/br.lua
Expand Up @@ -22,10 +22,12 @@ Locales['br'] = {
['not_work_with_npc'] = 'Nos não queremos este veículo no momento',
['pawn_shop_blip'] = 'Receptador de veículos',
['pawn_shop_menu'] = 'Pressione ~r~E~s~ para falar com o negociador',
['black_garage_menu'] = 'Press ~r~E~s~ to open Illegal Garage menu',
['pawnshop_buyitem'] = 'Comprar equipamento',
['pawnshop_menu_title'] = 'negociação com receptador',
['black_menu_title'] = 'Illegal Garage',
['pawnshop_rebuy'] = 'Comprar um veículo roubado',
['pawnshop_resell'] = 'Vender um veículo roubado',
['blackgarage_resell'] = 'Vender um veículo roubado',
['please_wait'] = 'Você está forçando a fechadura... ~b~%s minutos %s segundos~s~',
['resellcar'] = 'compre um veículo roubado',
['rucops'] = 'Checando sua identificação.........',
Expand Down
2 changes: 2 additions & 0 deletions locales/en.lua
Expand Up @@ -22,8 +22,10 @@ Locales['en'] = {
['not_work_with_npc'] = 'this vehicle belongs to no one',
['pawn_shop_blip'] = 'Pawn Shop',
['pawn_shop_menu'] = 'Press ~r~E~s~ to open Pawn Shop menu',
['black_garage_menu'] = 'Press ~r~E~s~ to open Illegal Garage menu',
['pawnshop_buyitem'] = 'buy equipment',
['pawnshop_menu_title'] = 'Pawn Shop',
['black_menu_title'] = 'Illegal Garage',
['pawnshop_rebuy'] = 'buy a vehicle',
['pawnshop_resell'] = 'sell a stolen vehicle',
['please_wait'] = 'Trying to open the door will take you ~b~%s minutes %s secondes~s~',
Expand Down
2 changes: 2 additions & 0 deletions locales/fr.lua
Expand Up @@ -22,8 +22,10 @@ Locales['fr'] = {
['not_work_with_npc'] = 'ce véhicule n\'appartien a personne',
['pawn_shop_blip'] = 'Pawn Shop',
['pawn_shop_menu'] = 'Appuyez sur ~r~E~s~ pour ouvrir le menu du Pawn Shop',
['black_garage_menu'] = 'Appuyez sur ~r~E~s~ pour ouvrir le menu du Garage illégal',
['pawnshop_buyitem'] = 'acheter du matériel',
['pawnshop_menu_title'] = 'Pawn Shop',
['black_menu_title'] = 'Garage illégal',
['pawnshop_rebuy'] = 'racheter un véhicule',
['pawnshop_resell'] = 'vendre un véhicule volé',
['please_wait'] = 'Tenter d\'ouvrir la porte va vous prendre ~b~%s minutes %s secondes~s~',
Expand Down

0 comments on commit a618280

Please sign in to comment.