I need some help being able to make sure that only one team (category) gets the XP (this system https://github.com/vrondakis/Leveling-System). This is the conquest system I am using (https://github.com/Bambofy/ConquestSystem), I have modified this addon slightly to fix a few things like the colouring of the icons when a team captures them, but I need help on that when the opposite team captures the point, the other team does not. For example if the Insurgent team captures the point, at the moment the only people who get XP is the specific team that captured it. I can’t seem to get this table working very well and could use some help with it. This is what the current set up is at the moment:
SHARE_POINTS_TABLE = SHARE_POINTS_TABLE || { };
hook.Add( "InitPostEntity", "SetupTeamIDS", function( )
SHARE_POINTS_TABLE = {
// Team 1
[ TEAM_NATO ] = 1;
[ TEAM_NATO1 ] = 1;
[ TEAM_NATO2 ] = 1;
[ TEAM_NATO3 ] = 1;
[ TEAM_NATO4 ] = 1;
[ TEAM_NATO5 ] = 1;
[ TEAM_NATO6 ] = 1;
[ TEAM_NATO7 ] = 1;
[ TEAM_NATO8 ] = 1;
[ TEAM_NATO9 ] = 1;
[ TEAM_NATO10 ] = 1;
[ TEAM_NATO11 ] = 1;
[ TEAM_NATO12 ] = 1;
[ TEAM_NATO13 ] = 1;
[ TEAM_NATO14 ] = 1;
[ TEAM_NATO15 ] = 1;
[ TEAM_NATO16 ] = 1;
[ TEAM_NATO17 ] = 1;
[ TEAM_NATO18 ] = 1;
[ TEAM_NATO19 ] = 1;
[ TEAM_NATO20 ] = 1;
// Team 2
[ TEAM_INSUR ] = 2;
[ TEAM_INSUR1 ] = 2;
[ TEAM_INSUR2 ] = 2;
[ TEAM_INSUR3 ] = 2;
[ TEAM_INSUR4 ] = 2;
[ TEAM_INSUR5 ] = 2;
[ TEAM_INSUR6 ] = 2;
[ TEAM_INSUR7 ] = 2;
[ TEAM_INSUR8 ] = 2;
[ TEAM_INSUR9 ] = 2;
[ TEAM_INSUR10 ] = 2;
[ TEAM_INSUR11 ] = 2;
[ TEAM_INSUR12 ] = 2;
[ TEAM_INSUR13 ] = 2;
[ TEAM_INSUR14 ] = 2;
[ TEAM_INSUR15 ] = 2;
[ TEAM_INSUR16 ] = 2;
[ TEAM_INSUR17 ] = 2;
[ TEAM_INSUR18 ] = 2;
[ TEAM_INSUR19 ] = 2;
[ TEAM_INSUR20 ] = 2;
};
end );
--[[-------------------------------------------------------------------------
Rewards
---------------------------------------------------------------------------]]
hook.Add("ConquestSystem_PointCaptured", "ConquestSystem_RewardsCaptured", function(ply, teamname, pointname, _capturer, _teammate)
if not ConquestSystem.Config.Rewards.Enabled then return end
ply:addMoney(ConquestSystem.Config.Rewards.OnCapture.ForPlayer)
for k,v in pairs(player.GetAll()) do
local job = RPExtraTeams[v:Team()]
if job.command == teamname then
local XP = v:addXP(500, true)
if(XP) then
DarkRP.notify(v,0,4,"You got "..XP.."XP for capturing a control point")
end
end
if ( IsValid( _capturer ) && IsValid( _teammate ) && _capturer:IsPlayer( ) && _teammate:IsPlayer( ) ) then
if ( SHARE_POINTS_TABLE[ _capturer:Team( ) ] == SHARE_POINTS_TABLE[ _teammate:Team( ) ] ) then
local XP = v:addXP(250, true)
if(XP) then
DarkRP.notify(v,0,4,"You got "..XP.."XP for your team capturing a control point")
end
else
DarkRP.notify(v,0,4,"The enemy captured a control point!")
end
end
end
end)
hook.Add("ConquestSystem_CapturedPointTick", "ConquestSystem_RewardsWhileCaptured", function(point, teamname, pointaname, _capturer, _teammate)
if not ConquestSystem.Config.Rewards.Enabled then return end
point.Interval = point.Interval + 1
if point.Interval >= ConquestSystem.Config.Rewards.WhileCaptured.Interval then
for k,v in pairs(player.GetAll()) do
local job = RPExtraTeams[v:Team()]
if job.command == teamname then
local XP = v:addXP(250, true)
if(XP) then
DarkRP.notify(v,0,4,"You got "..XP.."XP holding a control point")
end
end
if ( IsValid( _capturer ) && IsValid( _teammate ) && _capturer:IsPlayer( ) && _teammate:IsPlayer( ) ) then
if ( SHARE_POINTS_TABLE[ _capturer:Team( ) ] == SHARE_POINTS_TABLE[ _teammate:Team( ) ] ) then
local XP = v:addXP(100, true)
if(XP) then
DarkRP.notify(v,0,4,"You got "..XP.."XP for your team holding a control point")
end
end
end
end
point.Interval = 0
end
end)
This is a frankenstein kinda set up also with a friendly fire script to stop people from shooting each other in the same team (and yes setting each job to a different team was the only way to stop the script from bugging and that script was the only thing I could find that was working).
If more code from the other Lua files of these addons needs to be shown then I will, though this is the main issue I’m having right now.