I’m trying to make a ULX addon to give roles, but it won’t work. The detective is old code, and I want the role code to trigger when the round starts. I tried it on the traitor command, but it wont work. Error code:
Lua code:
local CATEGORY_NAME = "Britannia TTT"
function ulx.group(calling_ply)
calling_ply:SendLua([[gui.OpenURL("http://steamcommunity.com/groups/britanniattt")]])
end
local group = ulx.command(CATEGORY_NAME, "ulx group", ulx.group, "!group", true)
group:help(" Shows link to our Steam Group." )
group:defaultAccess(ULib.ACCESS_ADMIN)
function ulx.traitor(calling_ply)
hook.add("TTTBeginRound", calling_ply:UniqueID() .. "_traitor", function()
if ply:GetRoleString() != "traitor" then
calling_ply:SetRole(ROLE_TRAITOR)
calling_ply:AddCredits(2))
end
end
function ulx.detective(calling_ply)
calling_ply:SetRole(ROLE_DETECTIVE)
calling_ply:AddCredits(1)
end
local traitor = ulx.command(CATEGORY_NAME, "ulx traitor", ulx.traitor, "!traitor", true)
local detective = ulx.command(CATEGORY_NAME, "ulx detective", ulx.detective, "!detective", true)
traitor:help("Robi ciebie zdrajcą")
traitor:defaultAccess(ULib.ACCESS_ADMIN)
detective:help("Robi ciebie detektywem")
detective:defaultAccess(ULib.ACCESS_ADMIN)