rpmods = {}
rpmods.tool = {}
rpmods.jobs = {}
function rpmods.tool.func( ply, ent )
if tobool(FPP.Settings.FPP_GRAVGUN1.noshooting) then
if( !ply or !ply:IsValid() ) then return false end
if( SERVER ) then
ply:GetActiveWeapon().Charges = ply:GetActiveWeapon().Charges or 0
local ammo = ply:GetActiveWeapon().Charges
if( ammo <= 0 ) then
ply:SendLua([[LocalPlayer():GetActiveWeapon().CanShoot = false]])
else
ply:SendLua([[LocalPlayer():GetActiveWeapon().CanShoot = true]])
end
end
if( CLIENT ) then
if( !ply:GetActiveWeapon().CanShoot ) then
return false
end
end
if( !ply:GetActiveWeapon().BeenShot ) then
rpmods.jobs[ply:Team()].func(ply,ent)
ply:GetActiveWeapon().BeenShot = true
timer.Simple(0.5, function() ply:GetActiveWeapon().BeenShot = false end)
if( SERVER ) then DropEntityIfHeld(ent) return false elseif( CLIENT ) then return true end
end
if( SERVER ) then DropEntityIfHeld(ent) end
return false -- ...and return false
end
end
hook.Add("GravGunPunt", "PuntFunction", rpmods.tool.func)
-- Quick and dirty job fix --
-- Example: local TEAM_CITIZEN = TEAM_CITIZEN or <The number returened from player:Team()>
local TEAM_CITIZEN = TEAM_CITIZEN or 1
-- Add Jobs Below This Line --
-- Example: rpmods.jobs[TEAM_CITIZEN] = {func = function( ply ) ply:ChatPrint("Hello World") end} )
rpmods.jobs[TEAM_CITIZEN] = {func = function( ply, ent ) ply:ChatPrint("Hello World") end}
I have made the code above, but I can not figure out why it is not working, and by not working I mean it is not even throwing errors (I wish it was, would make my life easier...).
If any one can help me debug it that would help me out allot. ( Currently I am putting this directly in lua/autorun. )