Skip to content

Commit 274087e

Browse files
committed
Updated Bank Robbery System
1 parent 7270048 commit 274087e

File tree

8 files changed

+221
-181
lines changed

8 files changed

+221
-181
lines changed

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Matheus de Moraes Gon�alves Malheiros
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

-6
This file was deleted.

README.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Bank Robbery System - Bank Robbery System for DarkRP 2.6+
2+
Created by n00bmobile (STEAM_0:1:69472670)
3+
You can contact me through my newly created e-mail: [email protected]
4+
5+
1. Extract the contents of this compressed folder to your addons folder.
6+
2. Copy the resource folder to garrysmod root folder.
7+
3. You can configurate this addon by editing bank_config.lua. Just search for it, you lazy! You'll find it for sure!
8+
4. Report any bugs you find to me ;)

lua/autorun/bank_load.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MsgN("[BankRS]: Version 1.8.1 Loaded!")
1+
MsgN("[BankRS]: Version 1.8.2 Loaded!")
22

33
if (SERVER) then
44
AddCSLuaFile("bank_config.lua")

lua/bank_config.lua

+22-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
BankRS_Config = {
2-
["Robbery"] = {
3-
["Timer"] = 300, //The amount of time needed to finish a bank robbery.
4-
["Max_Distance"] = 500, //The maximum distance that you can go from the bank during a robbery.
5-
["Min_Cops"] = 4, //Minimum number of teams considered cops by the bank needed to start a robbery. (0 to disable)
6-
["Min_Bankers"] = 0, //Minimum number of teams considered bankers by the bank needed to start a robbery. (0 to disable)
7-
["Min_Players"] = 10, //Minimum of players needed to start a robbery. (0 to disable)
8-
["Killer_Reward"] = 1500, //The reward won by the player who kills the robber.
9-
["Should_Loop"] = true, //Should the siren sound loop?
10-
["Team_Required"] = { //The teams considered cops/robbers/bankers by the bank.
11-
["Cops"] = {"Civil Protection", "Civil Protection Chief"},
12-
["Bankers"] = {},
13-
["Robbers"] = {"Mob boss", "Gangster"},
1+
bank_config = {
2+
robbery = {
3+
time = 300, --> The amount of time needed to finish a bank robbery.
4+
m_dist = 500, --> The maximum distance that you can go from the bank during a robbery.
5+
m_cops = 1, --> Minimum number of teams considered cops by the bank needed to start a robbery. (0 to disable)
6+
m_bankers = 0, --> Minimum number of teams considered bankers by the bank needed to start a robbery. (0 to disable)
7+
m_players = 2, --> Minimum of players needed to start a robbery. (0 to disable)
8+
killer_reward = 1500, --> The reward won by the player who kills the robber.
9+
loop = true, --> Should the siren sound loop?
10+
t_required = { --> The teams considered cops/robbers/bankers by the bank.
11+
cops = {"Civil Protection", "Civil Protection Chief", "Mendigo"},
12+
bankers = {},
13+
robbers = {"Mob boss", "Gangster", "Cidadão"},
1414
},
1515
},
16-
["Interest"] = {
17-
["Interest_Delay"] = 300, //The delay between increasing the bank's reward.
18-
["Interest_Amount"] = 1500, //The amount to increase in each interest.
19-
["Base_Reward"] = 50000, //The base amount of money without any interest available to rob from the bank.
20-
["Reward_Max"] = 100000, //As high as interest can make the reward go.
16+
17+
interest = {
18+
delay = 300, --> The delay between increasing the bank's reward.
19+
amount = 1500, --> The amount to increase in each interest.
20+
base = 50000, --> The base amount of money without any interest available to rob from the bank.
21+
max = 100000, --> As high as interest can make the reward go.
2122
},
22-
["Cooldown"] = {
23-
["Timer"] = 500, //The amount of time that you need to wait before you can rob the bank again after a failed/sucessfull robbery.
23+
24+
cooldown = {
25+
time = 300, --> The amount of time that you need to wait before you can rob the bank again after a failed/sucessfull robbery.
2426
},
2527
}

lua/entities/bank_vault/cl_init.lua

+33-25
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
include("shared.lua")
22

3-
surface.CreateFont("BankFont", {font = "Coolvetica", size = 100}) //I don't know why, but as long as this number is high the font looks fine!
3+
surface.CreateFont("bankFont", {font = "Coolvetica", size = 100}) --I don't know why, but as long as this number is high the font looks fine!
44
function ENT:Draw()
55
local pos = self:GetPos()
66
local ang = self:GetAngles()
7-
local ang2 = self:GetAngles()
7+
local ang2 = self:GetAngles()
88

9-
if (not self.rotate) then
9+
if not self.rotate then
1010
self.rotate = 0
1111
end
1212

13-
if (not self.lasttime) then
13+
if not self.lasttime then
1414
self.lasttime = 0
1515
end
1616

@@ -23,48 +23,56 @@ function ENT:Draw()
2323
ang2:RotateAroundAxis(ang2:Right(), self.rotate +180)
2424

2525
cam.Start3D2D(pos, ang, 0.15)
26-
draw.SimpleTextOutlined(DarkRP.formatMoney(self:GetNWInt("CurrentReward")), "BankFont", 0, -480, Color(20, 150, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
26+
draw.SimpleTextOutlined(DarkRP.formatMoney(self:GetNWInt("bankReward")), "bankFont", 0, -485, Color(20, 150, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
2727

28-
if (self:GetNWString("Status") == "") then
29-
draw.SimpleTextOutlined("Bank Vault", "BankFont", 0, -560, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
28+
if self:GetNWString("bankStatus") == "" then
29+
draw.SimpleTextOutlined("Bank Vault", "bankFont", 0, -565, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
3030
else
31-
draw.SimpleTextOutlined("Bank Vault", "BankFont", 0, -635, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
32-
draw.SimpleTextOutlined(self:GetNWString("Status"), "BankFont", 0, -560, Color(255, 9, 9, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
31+
draw.SimpleTextOutlined("Bank Vault", "bankFont", 0, -640, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
32+
draw.SimpleTextOutlined(self:GetNWString("bankStatus"), "bankFont", 0, -565, Color(255, 9, 9, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
3333
end
3434
cam.End3D2D()
3535

3636
cam.Start3D2D(pos, ang2, 0.15)
37-
draw.SimpleTextOutlined(DarkRP.formatMoney(self:GetNWInt("CurrentReward")), "BankFont", 0, -480, Color(20, 150, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
37+
draw.SimpleTextOutlined(DarkRP.formatMoney(self:GetNWInt("bankReward")), "bankFont", 0, -485, Color(20, 150, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
3838

39-
if (self:GetNWString("Status") == "") then
40-
draw.SimpleTextOutlined("Bank Vault", "BankFont", 0, -560, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
39+
if self:GetNWString("bankStatus") == "" then
40+
draw.SimpleTextOutlined("Bank Vault", "bankFont", 0, -565, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
4141
else
42-
draw.SimpleTextOutlined("Bank Vault", "BankFont", 0, -635, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
43-
draw.SimpleTextOutlined(self:GetNWString("Status"), "BankFont", 0, -560, Color(255, 9, 9, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
42+
draw.SimpleTextOutlined("Bank Vault", "bankFont", 0, -640, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
43+
draw.SimpleTextOutlined(self:GetNWString("bankStatus"), "bankFont", 0, -565, Color(255, 9, 9, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 5, Color(0, 0, 0, 255))
4444
end
4545
cam.End3D2D()
4646

47-
if (self.rotate > 359) then
47+
if self.rotate > 359 then
4848
self.rotate = 0
4949
end
5050

5151
self.rotate = self.rotate -50 *(self.lasttime -CurTime())
5252
self.lasttime = CurTime()
5353
end
5454

55-
hook.Add("HUDPaint", "BankRS_HUDWarn", function()
56-
for k, v in pairs(ents.FindByClass("bank_vault")) do
57-
if (string.find(v:GetNWString("Status"), "Robbing") and table.HasValue(BankRS_Config["Robbery"]["Team_Required"]["Cops"], team.GetName(LocalPlayer():Team()))) then
58-
local pos = (v:GetPos() +Vector(0, 0, 80)):ToScreen()
59-
draw.DrawText(v:GetNWString("Status"), "Default", pos.x, pos.y, color_white, 1)
60-
end
55+
hook.Add("HUDPaint", "bank_draw_warning_hud", function()
56+
if table.HasValue(bank_config.robbery.t_required.cops, team.GetName(LocalPlayer():Team())) then
57+
for k, v in pairs(ents.FindByClass("bank_vault")) do
58+
if string.find(v:GetNWString("bankStatus"), "Robbing") then
59+
local pos = (v:GetPos() +Vector(0, 0, 80)):ToScreen()
60+
draw.DrawText(v:GetNWString("bankStatus"), "Default", pos.x, pos.y, color_white, 1)
61+
end
62+
end
6163
end
6264
end)
6365

64-
hook.Add("PreDrawHalos", "BankRS_HaloWarn", function()
65-
for k, v in pairs(ents.FindByClass("bank_vault")) do
66-
if (string.find(v:GetNWString("Status"), "Robbing") and table.HasValue(BankRS_Config["Robbery"]["Team_Required"]["Cops"], team.GetName(LocalPlayer():Team()))) then
67-
halo.Add({v}, Color(150, 20, 20), 0, 0, 5, true, true)
66+
hook.Add("PreDrawHalos", "bank_draw_warning_halo", function()
67+
if table.HasValue(bank_config.robbery.t_required.cops, team.GetName(LocalPlayer():Team())) then
68+
local onRobbery = {}
69+
70+
for k, v in pairs(ents.FindByClass("bank_vault")) do
71+
if string.find(v:GetNWString("bankStatus"), "Robbing") then
72+
table.insert(onRobbery, v)
73+
end
6874
end
75+
76+
halo.Add(onRobbery, Color(150, 20, 20), 0, 0, 5, true, true)
6977
end
7078
end)

0 commit comments

Comments
 (0)