Hello,
im currently working on a edit of the ttt custom roles addon to make it so that i define some classes are only for some roles.
p.e. Class Elf just for Innocents.
I edited the files and adding in the tables this option
AddCustomClass("ELF", {
color = Color(77, 146, 18, 255),
name = "elf",
role = "traitor",
weapons = {
"weapon_ttt_snowball",
"weapon_ttt_gift"
}
})
for the unset table you have to set a role too.. for me its
CLASSES.UNSET = {
index = 1,
name = "unset",
role = "innocent"
}
So that every inno gets no class..
But now i want that the table gets sorted... if a user gets traitor in the tttbeginround hook he should get only classes defined as role ="traitor"
for using the rolestring in ttt i uses this function
local currentrole = v:GetRoleString()
if currentrole == "traitor" then
----
end
this is used to check the role string match with the string in the table..
This here is the hook running the giving of the custom classes
hook.Add("TTTBeginRound", "TTTCSelectClasses", function()
if #POSSIBLECLASSES == 0 then return end
for _, v in ipairs(player.GetAll()) do
if v:IsActive() and not v:HasCustomClass() then
local cls
if #FREECLASSES == 0 then
local rand = math.random(1, #POSSIBLECLASSES)
cls = POSSIBLECLASSES[rand].index
else
local rand = math.random(1, #FREECLASSES)
cls = FREECLASSES[rand].index
table.remove(FREECLASSES, rand)
end
v:UpdateCustomClass(cls)
end
end
hook.Run("TTTCPreReceiveCustomClasses")
hook.Run("TTTCReceiveCustomClasses")
hook.Run("TTTCPostReceiveCustomClasses")
end)
after a little edit i made it so that just traitor classes gets the class (for testing purposes)
local currentrole = v:GetRoleString()
if currentrole == POSSIBLECLASSES[rand].role then
cls = POSSIBLECLASSES[rand].index --this allows the player to have a role cuz it matches the role and role in the table
else
cls = 1 --all other make it unset
end
--cls = POSSIBLECLASSES[rand].index --deactivated cuz not need
the github repo that i used is this one: GitHub
So i want that if a player has no custom class it gives a player a random class but it has to match the role the player has.. if not.. he should search for another role tillthe table role and the player role matches..
the freeclasses is just used if ur playing with limiting so that there could ne be double roles... but this is not needed cuz doubling is ok..
thanks alot for your patience
Hello Sodak,
You've used a fork of the original TTTC addon. Please use alfs version, since the version of lebroomer is outdated.
Additionally we plan on adding a better version of TTTC into TTT2, so this addon is no longer needed in the future
i dont want to use ttt2 cuz i need to rework most of my addons.. it should just a feature... i dont switch over to ttt2 cuz it modifies to much for me.
about 95% of the items should be compatible. We haven't found many that aren't.
Which one specificly does not work?
No i mean i have a custom script to get to boost the roles so superadmin hjave a higher chance to be traitor.. im overwriting the SelectRoles() function in the init.lua from the gamemode itself..
Idk if ttt2 will overwrite functions
does it support ps1?
most items i can fix on my own for ttt2..
Sorry, you need to Log In to post a reply to this thread.