• TTT Global GetRole Function
    4 replies, posted
Hey there! I am currently working on a custom TTT server with a good friend but we have ran into a problem. We are trying to add an additional role into TTT, which we have done successfully. The only problem is that the GetRole function is returning the new role as "nil" 0 and 1. We are trying to find where the GetRole function is located because it is called everywhere but we cannot find it. Is there anyway that any one of you can assist us? Thanks, -Google. :smile:
How are you using it?
[url]https://github.com/garrynewman/garrysmod/blob/ff51a59d5a821dec3c8f524631c86150b3e4744d/garrysmod/gamemodes/terrortown/gamemode/player_ext_shd.lua#L11[/url] They are using [URL="http://wiki.garrysmod.com/page/Global/AccessorFunc"]AccessorFunc[/URL]
Thanks so much ibot, he has pointed us in the right direction and we are taking a look. Other people can still post their opinions as we are still working on it, thanks.
So we've added the role to role_strings [code] local role_strings = { [ROLE_TRAITOR] = "traitor", [ROLE_INNOCENT] = "innocent", [ROLE_TEST] = "test", [ROLE_DETECTIVE] = "detective" }; [/code] and when we use this [code] for k,v in pairs(player.GetAll()) do RunConsoleCommand("say", tostring(v:GetRole())) RunConsoleCommand("say", tostring(v:GetRoleString())) end [/code] Console: "0" Console: "innocent" Console: "3" Console: "???" Console: "1" Console: "traitor" --------------------------- Console: "0" Console: "innocent" Console: "2" Console: "detective" Console: "1" Console: "traitor" I've also went ahead and added the proper edits to the language file. [editline]2nd January 2016[/editline] Nevermind we got it, you can mark this as solved. Thanks for the help guys.
Sorry, you need to Log In to post a reply to this thread.