I'm looking to remove the weapons from the detective player role in a TTT mod I have been working on. I am looking to strip the 1-4 slots and replace them with holstered (to prevent the player from picking up new weapons randomly) to keep going with idea. I tried to force give 4 holstered weapons to take the place of the weapons, but if the player has weapons already in those slots, the giving weapons fails. Is there a way to remove weapons on role selection?
[code]
hook.Add("TTTBeginRound", "DetectiveRemove", function()
for k,v in pairs(player.GetAll()) do
if v:GetRole() == ROLE_DETECTIVE then
v:Strip("weapons")
end
end)
[/code]
[QUOTE=Sm63;43458232][code]
hook.Add("TTTBeginRound", "DetectiveRemove", function()
for k,v in pairs(player.GetAll()) do
if v:GetRole() == ROLE_DETECTIVE then
v:Strip("weapons")
end
end)
[/code][/QUOTE]
[code]
hook.Add("TTTBeginRound", "DetectiveRemove", function()
for k,v in pairs(player.GetAll()) do
if v:IsActiveDetective() then
v:StripWeapons()
end
end
end)
[/code]
[QUOTE=Sm63;43458232][code]
hook.Add("TTTBeginRound", "DetectiveRemove", function()
for k,v in pairs(player.GetAll()) do
if v:GetRole() == ROLE_DETECTIVE then
v:Strip("weapons")
end
end)
[/code][/QUOTE]
[CODE]plymeta:GetDetective()[/CODE]
[editline]8th January 2014[/editline]
[QUOTE=crazyscouter;43458331][code]
hook.Add("TTTBeginRound", "DetectiveRemove", function()
for k,v in pairs(player.GetAll()) do
if v:IsActiveDetective() then
v:StripWeapons()
end
end
end)
[/code][/QUOTE]
You don't have to use IsActiveDetective since you're already using the TTTBeginRound hook.
Sorry, you need to Log In to post a reply to this thread.