My Mayor can not place a law board or add laws or remove laws
Please help me. Ask me if you need any of my code!
Can anybody help me?
Are you getting any errors? Need more information really, like a notification saying you're not allowed to spawn these or...?
I know this bug:
- If you clear all props using the server tab menu, it will break the law boards.
- Restart your server.
Hey Guys i am not getting any lua errors.
I have restarted the server a bunch of times.
Hmmmm.......
What files/stuff have you messed with before this started to happen?
Or is this a fresh install?
If you're using a custom mayor job, make sure that you have this stated in the job:
[LUA]mayor = true[/LUA]
As well, if you're using DarkRP 2.5, you can goto the settings.lua file, and find line 191 and check if this is set to something greater than 0:
[CODE]GM.Config.maxlawboards = 2[/CODE]
[B]Edited:[/B] Sorry for double post, thought I was editing my previous post.
I have not changed any files.
Have you tried to do /placelaws?
Yes
Well, in the darkrp gamemode, there's a file path: darkp/entities/entities/darkrp_laws/init.lua there are some commands that are defined in the init.lua.
Can you give me the init.lua code that you have?
[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local Laws = {}
local FixedLaws = {}
timer.Simple(0, function()
Laws = table.Copy(GAMEMODE.Config.DefaultLaws)
FixedLaws = table.Copy(Laws)
end)
function ENT:Initialize()
self:SetModel("models/props/cs_assault/Billboard.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if phys and phys:IsValid() then
phys:Wake()
phys:EnableMotion(false)
end
end
local function AddLaw(ply, args)
if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].mayor then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("incorrect_job", GAMEMODE.Config.chatCommandPrefix .. "addlaw"))
return ""
end
if not args or args == "" then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
return ""
end
if string.len(args) < 3 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("law_too_short"))
return ""
end
if #Laws >= 12 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("laws_full"))
return ""
end
table.insert(Laws, args)
umsg.Start("DRP_AddLaw")
umsg.String(args)
umsg.End()
DarkRP.notify(ply, 0, 2, DarkRP.getPhrase("law_added"))
return ""
end
DarkRP.defineChatCommand("addlaw", AddLaw)
local function RemoveLaw(ply, args)
if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].mayor then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("incorrect_job", GAMEMODE.Config.chatCommandPrefix .. "removelaw"))
return ""
end
if not tonumber(args) or not Laws[tonumber(args)] then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", DarkRP.getPhrase("arguments"), ""))
return ""
end
if FixedLaws[tonumber(args)] then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("default_law_change_denied"))
return ""
end
table.remove(Laws, tonumber(args))
umsg.Start("DRP_RemoveLaw")
umsg.Short(tonumber(args))
umsg.End()
DarkRP.notify(ply, 0, 2, DarkRP.getPhrase("law_removed"))
return ""
end
DarkRP.defineChatCommand("removelaw", RemoveLaw)
local numlaws = 0
local function PlaceLaws(ply, args)
if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].mayor then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("incorrect_job", GAMEMODE.Config.chatCommandPrefix .. "placelaws"))
return ""
end
if numlaws >= GAMEMODE.Config.maxlawboards then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("limit", GAMEMODE.Config.chatCommandPrefix .. "placelaws"))
return ""
end
local trace = {}
trace.start = ply:EyePos()
trace.endpos = trace.start + ply:GetAimVector() * 85
trace.filter = ply
local tr = util.TraceLine(trace)
local ent = ents.Create("darkrp_laws")
ent:SetPos(tr.HitPos + Vector(0, 0, 100))
local ang = ply:GetAngles()
ang:RotateAroundAxis(ang:Up(), 180)
ent:SetAngles(ang)
ent:CPPISetOwner(ply)
ent.SID = ply.SID
ent:Spawn()
ent:Activate()
if IsValid(ent) then
numlaws = numlaws + 1
end
ply.lawboards = ply.lawboards or {}
table.insert(ply.lawboards, ent)
return ""
end
DarkRP.defineChatCommand("placelaws", PlaceLaws)
function ENT:OnRemove()
numlaws = numlaws - 1
end
hook.Add("PlayerInitialSpawn", "SendLaws", function(ply)
for i, law in pairs(Laws) do
if FixedLaws[i] then continue end
umsg.Start("DRP_AddLaw", ply)
umsg.String(law)
umsg.End()
end
end)[/CODE]
An important factor to take into consideration is [I]what happens when you try[/I]. A notification probably appears (bottom right). What does it say?
It say's noting when writing the command it basically say's the command in chat.
No messages at all. It's just like a normal chat message.
Can anybody help me fix this?
Sorry about bumping this.
[QUOTE=Alex Munao;43693574]It say's noting when writing the command it basically say's the command in chat.
No messages at all. It's just like a normal chat message.[/QUOTE]
Must mean that the command is not be captured at all. Check for Lua errors in the server console after a server restart.
I have restarted the server and no errors.
What should i do?
Sorry :) Have to get this fixed.
BUMP!
Try adding a fresh version of DarkRP or maybe you have an addon that's conflicting with it (highly doubt it).
Sorry, you need to Log In to post a reply to this thread.