• Help me solve my problem
    4 replies, posted
Hello guys, i've found script on your forum, which replace detective model (from default to custom). And i want to make it for innocent model, but i don't know coding :<<< Can someone help me? P.S. I tried "IsActiveInnocent", but it won't work :( [code] hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:IsActiveDetective() then v:SetModel(Model("your_model.mdl")) end end end) [/code]
[code] hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:GetRole() == ROLE_INNOCENT then v:SetModel(Model("your_model.mdl")) end end end) [/code] Untested, but is probably right.
You don't want to make it for innocents because then you'd find out who the traitors are from models, so you'll want to do it for everyone If I recall, there's a table in terrortown's shared.lua in which you can modify what model everyone is randomly assigned, so check there
[QUOTE=Lolcats;45247375][code] hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:GetRole() == ROLE_INNOCENT then v:SetModel(Model("your_model.mdl")) end end end) [/code] Untested, but is probably right.[/QUOTE] Thank you! It's working. Also thank you both for quick answer.
[URL="https://github.com/garrynewman/garrysmod/blob/64242f4ecd2d0f7d29e36caa4c1d727cb6ff00d9/garrysmod/gamemodes/terrortown/gamemode/player_ext_shd.lua"]https://github.com/garrynewman/garrysmod/blob/64242f4ecd2d0f7d29e36caa4c1d727cb6ff00d9/garrysmod/gamemodes/terrortown/gamemode/player_ext_shd.lua[/URL] ply:IsActiveRole(ROLE_INNOCENT)
Sorry, you need to Log In to post a reply to this thread.