So I have this capture points addon for DarkRP and it is missing the key component to make it work which is the server side file. I would really like this solved so I can use the addon. I was wondering if anyone can code the server side file for me. Below I have all the other files code below to help you out
rpcp_config.lua
[LUA]RPCP.padding = 28 --How much space is between each of the control point displays (if you run out of text space)
–Add your teams here.
RPCP.addteam(“U.S Army”, {
jobs = {
TEAM_USARMY1,TEAM_USARMY2,TEAM_USARMY3,TEAM_USARMY4,TEAM_USARMY5,TEAM_USARMY6,TEAM_USARMY7,TEAM_USARMY8,TEAM_USARMY9,TEAM_USARMY10,TEAM_USARMY11,TEAM_USARMY12,TEAM_USARMY13,TEAM_USARMY14,TEAM_USARMY15,TEAM_USARMY16,TEAM_USARMY17,TEAM_USARMY18,TEAM_USARMY19,TEAM_USARMY20,TEAM_USARMY21,TEAM_USARMY22,TEAM_USARMY23,TEAM_USARMY24,TEAM_USARMY25,TEAM_USARMY26,TEAM_USARMY27,TEAM_USARMY28,TEAM_USARMY29,TEAM_USARMY30,TEAM_USARMY31,TEAM_USARMY32,TEAM_USARMY33,TEAM_USARMY34,TEAM_USARMY35,TEAM_USARMY36,TEAM_USARMY38,TEAM_USARMY39,TEAM_USARMY40,TEAM_USARMY41
},
model = "models/gmod_myflags3.mdl",
skin = 0,
color = Color(0, 117, 16), --What color to display on the HUD when this team captures a point.
})
RPCP.addteam(“VietCong”, {
jobs = {
TEAM_VIET1,TEAM_VIET2,TEAM_VIET3,TEAM_VIET4,TEAM_VIET5,TEAM_VIET6,TEAM_VIET7,TEAM_VIET8,TEAM_VIET9,TEAM_VIET10,TEAM_VIET11,TEAM_VIET12,TEAM_VIET13,TEAM_VIET14,TEAM_VIET15,TEAM_VIET16,TEAM_VIET17,TEAM_VIET18,TEAM_VIET19,TEAM_VIET20,TEAM_VIET21,TEAM_VIET22,TEAM_VIET23,TEAM_VIET24,TEAM_VIET25,TEAM_VIET26,TEAM_VIET27,TEAM_VIET28,TEAM_VIET29,TEAM_VIET30,TEAM_VIET31,TEAM_VIET32,TEAM_VIET33,TEAM_VIET34,TEAM_VIET35,TEAM_VIET36,TEAM_VIET37,TEAM_VIET38,TEAM_VIET39,TEAM_VIET40,TEAM_VIET41
},
model = "models/gmod_myflags3.mdl",
skin = 22,
color = Color(161, 0, 0), --What color to display on the HUD when this team captures a point.
})
–Add your flags here.
— rp_downtown_v4c_v2
RPCP.addflag(“Flag A”, {
map = "rp_downtown_v4c_v2",
position = Vector(241.714111, 714.234985, -139.968750 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 1, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 700, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– rp_bangclaw
RPCP.addflag(“Flag A”, {
map = "rp_bangclaw",
position = Vector(1950.042480, -2235.197754, 128.031250 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 700, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
RPCP.addflag(“Flag B”, {
map = "rp_bangclaw",
position = Vector(5877.150879, 346.491486, -127.968750 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64),
salary = 700,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 500, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– Raid_predator
RPCP.addflag(“Flag A”, {
map = "raid_predator",
position = Vector(-792.801270, 402.861084, -531.968750 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 700, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
–cs_jungle
RPCP.addflag(“Flag A”, {
map = "cs_jungle",
position = Vector(-953.253296, -1119.689209, 165.853989 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 700, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– rp_nova_prospekt_v4
RPCP.addflag(“Flag A”, {
map = "rp_nova_prospekt_v4",
position = Vector(-2166.539063, 2093.565918, 576.031250 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 300, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– Gm_desertdriveing
RPCP.addflag(“Flag A”, {
map = "gm_desertdriving",
position = Vector(2887.066162, 630.276489, 646.012695 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 25, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 300, --How far away a player needs to be actively capping
passiverange = 2000, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– gm_bay
RPCP.addflag(“Flag A”, {
map = "gm_bay",
position = Vector(-1188.794678, 1345.936768, 122.831207 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 15, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 300, --How far away a player needs to be actively capping
passiverange = 2000, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– GM_HARVEST
RPCP.addflag(“Flag A”, {
map = "gm_harvest",
position = Vector(-6562.786133, 6673.778320, 64.273743 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 0, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 650, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 350, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
– omaha
RPCP.addflag(“Flag A”, {
map = "omaha",
position = Vector(-1624.141968, -4895.520508, -1064.156738 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 0, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 650, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 350, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})
— CityRuins
RPCP.addflag(“Flag A”, {
map = "cityruins",
position = Vector(-2615, 956, -276 - 64),
angles = Angle(0, 0, 0),
cappercount = 1, --How many players it takes to cap this flag
requiredplayers = 10, --How many players PER TEAM are required for this flag to ACTIVATE in the first place
capturetime = 15, --How long (in seconds) it takes to cap this flag
highlight = Color(0, 255, 64), --What color the name will highlight as on the hud when the player is near
salary = 700, --Money granted per minute for this flag
salarymodifier = function(ply, money, flags) --Here's where you can do stuff to the salary (optional)
return money * flags --Default behavior
end,
activerange = 200, --How far away a player needs to be actively capping
passiverange = 700, --How far away a player needs to be in order to be considered "close"
activebonus = 700, --How much money an active capper gets
passivebonus = 500, --How much money someone who is near gets
bonusmodifier = function(ply, money) --This is where you add your usergroup specific bonuses (optional)
if ply:Name() == "Ott" then
money = money * 2
end
return money
end,
model = "models/gmod_myflags4.mdl", --Default, uncaptured model
skin = 16, --Default, uncaptured skin
})[/LUA]
rpcp_flag.lua (The entity)
[LUA]
AddCSLuaFile()
local BaseClass = baseclass.Get( “base_anim” )
ENT.PrintName = “Flag”
ENT.Author = “Ott”
ENT.RenderGroup = RENDERGROUP_OPAQUE
function ENT:Initialize()
if SERVER then
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_NONE)
end
end
local time = CurTime()
local prevtime = CurTime()
local delta = 0
function ENT:Think()
if SERVER then
self:SetNWFloat("capturetime", self.table.capturetime)
self:SetNWString("name", self.table.name)
if self.table.requiredplayers <= #player.GetAll() then
local e = ents.FindInSphere(self:GetPos(), self.table.passiverange)
local plys = {}
for key, ent in pairs(e) do
if IsValid(ent) and ent:GetClass() == "player" then
table.insert(plys, ent)
end
end
local cappers = {}
local pass = true
local team
for _, ply in pairs(plys) do
if ply:Alive() then
if ply:GetPos():Distance(self:GetPos()) < self.table.activerange then
table.insert(cappers, ply)
for name, tbl in pairs(RPCP.teams) do
if table.HasValue(tbl.jobs, ply:Team()) then
if team and team ~= name then
pass = false
break
else
team = name
end
end
end
end
end
end
time = CurTime()
delta = time - prevtime
if pass and team then --People are on the flag
if team ~= self:GetNWString("defenders") then
if #cappers >= self.table.cappercount then --Flag can be captured now
if team ~= self:GetNWString("attackers") then
PrintMessage(HUD_PRINTCENTER, self.table.name .. " is being captured by " .. team .. "!")
end
self:SetNWString("attackers", team)
self:SetNWFloat("captime", self:GetNWFloat("captime") + delta)
--print(self.table.name .. " is being captured by " .. team .. "! (" .. math.ceil(self:GetNWFloat("captime")) .. ")")
if self:GetNWFloat("captime") > self.table.capturetime then --Flag is captured
for _, ply in pairs(plys) do
for name, tbl in pairs(RPCP.teams) do
if table.HasValue(tbl.jobs, ply:Team()) then
if name == team then
--11 layers of indentation. Wow.
local value = self.table.passivebonus
if self.table.bonusmodifier then
value = self.table.bonusmodifier(ply, value) or value
end
ply:addMoney(value)
DarkRP.notify(ply, 4, 4, "You received a $" .. value .. " bonus for helping to capture " .. self.table.name .. "!")
--DarkRP Control Points was made by Ott (STEAM_0:0:36527860), who was hired by Sgt.Val (STEAM_0:0:14807885).
DarkRP.notify(ply, 4, 8, "Good work! Keep defending the flag to receive salary!")
end
end
end
end
for _, ply in pairs(cappers) do
local value = self.table.activebonus
if self.table.bonusmodifier then
value = self.table.bonusmodifier(ply, value) or value
end
ply:addMoney(value)
DarkRP.notify(ply, 4, 4, "You received a $" .. value .. " bonus for capturing " .. self.table.name .. "!")
end
PrintMessage(HUD_PRINTCENTER, self.table.name .. " has been captured by " .. team .. "!")
self:SetNWString("defenders", team)
self:SetNWString("attackers", nil)
self:SetNWFloat("captime", 0)
self:SetModel(RPCP.teams[team].model)
self:SetSkin(RPCP.teams[team].skin)
timer.Destroy("RPCP_salary_" .. self.table.name)
timer.Create("RPCP_salary_" .. self.table.name, 15, 0, function()
local e = ents.FindInSphere(self:GetPos(), self.table.passiverange)
local plys = {}
for key, ent in pairs(e) do
if IsValid(ent) and ent:GetClass() == "player" then
table.insert(plys, ent)
end
end
for _, ply in pairs(plys) do
if table.HasValue(RPCP.teams[self:GetNWString("defenders")].jobs, ply:Team()) then
local count = 0
for k, v in pairs(RPCP.flags) do
if v.flag:GetNWString("defenders") == self:GetNWString("defenders") then
count = count + 1
end
end
local value = self.table.salary
print("base salary", value)
if self.table.salarymodifier then
value = self.table.salarymodifier(ply, value, count)
print("custom")
else
print(value, "*", count)
value = value * count
end
print("modified salary", value)
ply:addMoney(value)
DarkRP.notify(ply, 4, 4, "You received a $" .. value .. " salary for defending the flag.")
end
end
end)
end
end
end
else
self:SetNWFloat("captime", 0)
end
prevtime = time
else
timer.Destroy("RPCP_salary_" .. self.table.name)
end
end
end
function ENT:Draw()
if RPCP.flags[self:GetNWString("name")].requiredplayers <= #player.GetAll() then
self:DrawModel()
end
end[/LUA]
cl_rpcp.lua
[LUA]
RPCP = {
teams = {},
flags = {},
}
function RPCP.addteam(name, table)
RPCP.teams[name] = table
end
function RPCP.addflag(name, table)
if table.map == game.GetMap() then
table.name = name
RPCP.flags[name] = table
end
end
include(“rpcp_config.lua”)
hook.Add(“DarkRPFinishedLoading”, “rpcp”, function()
include("rpcp_config.lua")
end)
local box = {}
box.width = 64
box.height = 64
box.padding = RPCP.padding or 16
timer.Create(“rpcp_refresh”, 1, 0, function()
local e = ents.FindByClass("rpcp_flag")
for _, ent in pairs(e) do
local name = ent:GetNWString("name")
if RPCP.flags[name] then
RPCP.flags[name].flag = ent
end
end
end)
local times = {}
local toggles = {}
local inrange = {}
local function drawhud()
local inteam = false
for team, tab in pairs(RPCP.teams) do
if table.HasValue(tab.jobs, LocalPlayer():Team()) then
inteam = true
end
end
if inteam == false then
return
end
local count = table.Count(RPCP.flags)
local screenmid = ScrW() / 2
local i = 0
for name, table in SortedPairs(RPCP.flags) do
local textcolor = Color(255, 255, 255, 255)
local defendcolor = Color(255, 255, 255, 255)
local attackcolor = Color(0, 0, 0, 255)
local flag = table.flag
times[name] = times[name] or CurTime()
toggles[name] = toggles[name] or false
inrange[name] = inrange[name] or false
inrange[name] = false
if IsValid(flag) then
if flag:GetPos():Distance(LocalPlayer():GetPos()) < table.passiverange then
textcolor = table.highlight
if flag:GetPos():Distance(LocalPlayer():GetPos()) < table.activerange then
inrange[name] = true
end
end
defendcolor = RPCP.teams[flag:GetNWString("defenders")] and RPCP.teams[flag:GetNWString("defenders")].color or defendcolor
attackcolor = RPCP.teams[flag:GetNWString("attackers")] and RPCP.teams[flag:GetNWString("attackers")].color or attackcolor
end
local pos = i * (box.width + box.padding) + box.padding
local size = count * (box.width + box.padding) + box.padding
local x = screenmid - size / 2 + pos
----WARNING: SPAGHETTI CODE
draw.RoundedBox(16, x, ScrH() * 7 / 8, box.width, box.height, Color(0, 0, 0, 255))
draw.RoundedBox(16, x + 1, ScrH() * 7 / 8 + 1, box.width - 2, box.height - 2, defendcolor)
if IsValid(flag) then
local percentcapped = flag:GetNWFloat("captime") / flag:GetNWFloat("capturetime")
render.SetScissorRect(x + 1, (ScrH() * 7 / 8 + 1) + (box.height - 2) * (1 - percentcapped), (x + 1) + (box.width - 2), (ScrH() * 7 / 8 + 1) + (box.height - 2), true)
--DarkRP Control Points was made by Ott (STEAM_0:0:36527860), who was hired by Sgt.Val (STEAM_0:0:14807885).
draw.RoundedBox(16, x + 1, ScrH() * 7 / 8 + 1, box.width - 2, box.height - 2, attackcolor)
render.SetScissorRect(0, 0, 0, 0, false)
end
local d = table.position:ToScreen()
if d.visible then
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawRect(d.x - 15, d.y, 30, 1)
surface.DrawRect(d.x, d.y - 15, 1, 30)
draw.SimpleText(name, "ScoreboardPlayerNameBig", d.x + 15, d.y - 30, Color(255, 255, 255, 255))
draw.SimpleText(name, "ScoreboardPlayerNameBig", d.x + 16, d.y - 31, Color(255, 0, 0, 255))
end
draw.DrawText(name, "DermaLarge", x + box.width / 2, ScrH() * 7 / 8 - 32, (toggles[name] and inrange[name]) and Color(255, 255, 255, 255) or textcolor, TEXT_ALIGN_CENTER)
if CurTime() - times[name] > 0.5 then
toggles[name] = not toggles[name]
times[name] = CurTime()
end
i = i + 1
end
end
hook.Add(“HUDPaint”, “RPCP_DrawHud”, drawhud)[/LUA]