Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QB-Target #60

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The 2.0 UI was redesigned by [qwadebot](https://github.com/qw-scripts) Edited by
# Dependencies
* [oxmysql](https://github.com/overextended/oxmysql)
* [ox-lib](https://github.com/overextended/ox_lib)
* [ox-target](https://github.com/overextended/ox_target)
* [ox-target](https://github.com/overextended/ox_target) or [qb-target] (https://github.com/qbcore-framework/qb-target)
Note: Supports QBCore and ESX. You can easily add support for other frameworks by editing the Framework.lua

# Features
Expand Down
118 changes: 82 additions & 36 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,31 @@ CreateThread(function ()
cb(newTransaction)
end)
end
exports.ox_target:addModel(Config.atms, {{
name = 'renewed_banking_openui',
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('view_bank'),
atm = true,
canInteract = function(_, distance)
return distance < 2.5
end
}})
if Config.target == 'qb-target' then
exports['qb-target']:AddTargetModel(Config.atms, {
options = {
{
name = 'renewed_banking_openui',
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('view_bank'),
atm = true,
}
},
distance = 2.5,
})
elseif Config.target == 'ox_target' then
exports.ox_target:addModel(Config.atms, {{
name = 'renewed_banking_openui',
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('view_bank'),
atm = true,
canInteract = function(_, distance)
return distance < 2.5
end
}})
end
end)

local pedSpawned = false
Expand Down Expand Up @@ -116,29 +131,54 @@ function CreatePeds()
AddTextComponentString('Bank')
EndTextCommandSetBlipName(blips[k])
end
if Config.target == 'qb-target' then
exports['qb-target']:AddTargetEntity(peds.basic, {
options = {
{
type = "client",
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('manage_bank'),
}
},
distance = 2.5
})

local targetOpts ={{
name = 'renewed_banking_openui',
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('view_bank'),
atm = false,
canInteract = function(_, distance)
return distance < 4.5
end
}}
exports.ox_target:addLocalEntity(peds.basic, targetOpts)
targetOpts[#targetOpts+1]={
name = 'renewed_banking_accountmng',
event = 'Renewed-Banking:client:accountManagmentMenu',
icon = 'fas fa-money-check',
label = locale('manage_bank'),
atm = false,
canInteract = function(_, distance)
return distance < 4.5
end
}
exports.ox_target:addLocalEntity(peds.adv, targetOpts)
exports['qb-target']:AddTargetEntity(peds.adv, {
options = {
{
type = "client",
event = 'Renewed-Banking:client:accountManagmentMenu',
icon = 'fas fa-money-check',
label = locale('manage_bank'),
}
},
distance = 2.5
})
elseif Config.target == 'ox_target' then
local targetOpts ={{
name = 'renewed_banking_openui',
event = 'Renewed-Banking:client:openBankUI',
icon = 'fas fa-money-check',
label = locale('view_bank'),
atm = false,
canInteract = function(_, distance)
return distance < 4.5
end
}}
exports.ox_target:addLocalEntity(peds.basic, targetOpts)
targetOpts[#targetOpts+1]={
name = 'renewed_banking_accountmng',
event = 'Renewed-Banking:client:accountManagmentMenu',
icon = 'fas fa-money-check',
label = locale('manage_bank'),
atm = false,
canInteract = function(_, distance)
return distance < 4.5
end
}
exports.ox_target:addLocalEntity(peds.adv, targetOpts)
end
pedSpawned = true
end

Expand All @@ -157,9 +197,15 @@ end

AddEventHandler('onResourceStop', function(resource)
if resource ~= GetCurrentResourceName() then return end
exports.ox_target:removeModel(Config.atms, {'renewed_banking_openui'})
exports.ox_target:removeEntity(peds.basic, {'renewed_banking_openui'})
exports.ox_target:removeEntity(peds.adv, {'renewed_banking_openui','renewed_banking_accountmng'})
if Config.target == 'qb-target' then
exports['qb-target']:RemoveTargetModel(Config.atms, {'renewed_banking_openui'})
exports['qb-target']:RemoveTargetEntity(peds.basic, {'renewed_banking_openui'})
exports['qb-target']:RemoveTargetEntity(peds.adv, {'renewed_banking_openui','renewed_banking_accountmng'})
elseif Config.target == 'ox_target' then
exports.ox_target:removeModel(Config.atms, {'renewed_banking_openui'})
exports.ox_target:removeEntity(peds.basic, {'renewed_banking_openui'})
exports.ox_target:removeEntity(peds.adv, {'renewed_banking_openui','renewed_banking_accountmng'})
end
DeletePeds()
end)

Expand All @@ -173,4 +219,4 @@ end)

RegisterNetEvent('Renewed-Banking:client:viewAccountsMenu', function()
TriggerServerEvent('Renewed-Banking:server:getPlayerAccounts')
end)
end)
17 changes: 9 additions & 8 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Config = {
renewedMultiJob = false, -- QBCORE ONLY! https://github.com/Renewed-Scripts/qb-phone
progressbar = 'circle', -- circle or rectangle (Anything other than circle will default to rectangle)
currency ='USD', -- USD, EUR, GBP ect.....
target = 'ox_target', -- ox_target || qb-target
atms = {
`prop_atm_01`,
`prop_atm_02`,
Expand All @@ -14,36 +15,36 @@ Config = {
[1] = { -- Pacific Standard
model = 'u_m_m_bankman',
coords = vector4(241.44, 227.19, 106.29, 170.43),
createAccounts = true
createAccounts = true,
},
[2] = {
model = 'ig_barry',
coords = vector4(313.84, -280.58, 54.16, 338.31)
coords = vector4(313.84, -280.58, 54.16, 338.31),
},
[3] = {
model = 'ig_barry',
coords = vector4(149.46, -1042.09, 29.37, 335.43)
coords = vector4(149.46, -1042.09, 29.37, 335.43),
},
[4] = {
model = 'ig_barry',
coords = vector4(-351.23, -51.28, 49.04, 341.73)
coords = vector4(-351.23, -51.28, 49.04, 341.73),
},
[5] = {
model = 'ig_barry',
coords = vector4(-1211.9, -331.9, 37.78, 20.07)
coords = vector4(-1211.9, -331.9, 37.78, 20.07),
},
[6] = {
model = 'ig_barry',
coords = vector4(-2961.14, 483.09, 15.7, 83.84)
coords = vector4(-2961.14, 483.09, 15.7, 83.84),
},
[7] = {
model = 'ig_barry',
coords = vector4(1174.8, 2708.2, 38.09, 178.52)
coords = vector4(1174.8, 2708.2, 38.09, 178.52),
},
[8] = { -- paleto
model = 'u_m_m_bankman',
coords = vector4(-112.22, 6471.01, 31.63, 134.18),
createAccounts = true
createAccounts = true,
}
}
}
Loading