• TTT Custom Detective
    19 replies, posted
So I've been trying to finish this custom detective script with a help of a friend and we've tried several methods and nothing appears to be working for us , I was wondering if someone could come up with a code for me to use? here's what we've been trying to get to work hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:IsActiveDetective() then v:SetModel(Model("models/vinrax/player/re2/leon_normal.mdl")) end end end)
You don't need to do Model()
[QUOTE=AnonTakesOver;45568508]You don't need to do Model()[/QUOTE] So you're saying I don't need v:SetModel"(Model"
[code] hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:IsActiveDetective() then v:SetModel("models/vinrax/player/re2/leon_normal.mdl") end end end) [/code] Didn't look over the rest of the code, just fixed the Model("") part
[QUOTE=Dgc2002;45568597][code] hook.Add("TTTBeginRound", "BeginRoundDetectiveSkin", function() for k,v in pairs(player.GetAll()) do if v:IsActiveDetective() then v:SetModel("models/vinrax/player/re2/leon_normal.mdl") end end end) [/code] Didn't look over the rest of the code, just fixed the Model("") part[/QUOTE] Unfortunately this still doesn't work.
[QUOTE=bryson;45568711]Unfortunately this still doesn't work.[/QUOTE] can you confirm the model exists on client?
Does IsActiveDetective exist? I thought it was always just IsDetective.
[QUOTE=AnonTakesOver;45568783]can you confirm the model exists on client?[/QUOTE] Positive I could spawn it If I wanted too..
[QUOTE=code_gs;45568792]Does IsActiveDetective exist? I thought it was always just IsDetective.[/QUOTE] Yea they exist. [code] -- convenience functions for common patterns function plymeta:IsRole(role) return self:GetRole() == role end function plymeta:IsActiveRole(role) return self:IsRole(role) and self:IsActive() end function plymeta:IsActiveTraitor() return self:IsActiveRole(ROLE_TRAITOR) end function plymeta:IsActiveDetective() return self:IsActiveRole(ROLE_DETECTIVE) end function plymeta:IsActiveSpecial() return self:IsSpecial() and self:IsActive() end [/code]
[QUOTE=bryson;45568801]Positive I could spawn it If I wanted too..[/QUOTE] Are you running it serverside or clientside?
[QUOTE=code_gs;45568815]Are you running it serverside or clientside?[/QUOTE] I'm hosting the server myself and it's in my add-ons
[QUOTE=bryson;45568846]I'm hosting the server myself and it's in my add-ons[/QUOTE] No. Where is the file located?
[QUOTE=code_gs;45568917]No. Where is the file located?[/QUOTE] You're talking about the model right? If so , clientsided It's in my models
[QUOTE=bryson;45568931]You're talking about the model right? If so , clientsided It's in my models[/QUOTE] The script.
[QUOTE=AnonTakesOver;45568934]The script.[/QUOTE] In my TTT game mode folder , under myedit.lua I have in the Init.lua and cl_init.lua for it to include the myedit.lua EDIT : Unless there's another way I'm supposed to do this?
Put it in lua/autorun/server.
[QUOTE=code_gs;45569091]Put it in lua/autorun/server.[/QUOTE] Where in there? do I make like its own text document ? or? I'm total noob to this stuff :/
Download Notepad++ or Sublime.
[QUOTE=code_gs;45569328]Download Notepad++ or Sublime.[/QUOTE] Already have notepad++ I know how to save as a lua file and stuff but I don't get exactly what I'm supposed to name it.
[QUOTE=bryson;45569363]Already have notepad++ I know how to save as a lua file and stuff but I don't get exactly what I'm supposed to name it.[/QUOTE] The name isn't relevant, but it MUST be on lua/autorun/server. Place the file in that folder
Sorry, you need to Log In to post a reply to this thread.