I've played on servers that allowed the player to purchase a Traitor or a Detective role for the next round. What is the code for adding such a thing? There was only one other code I found through my search and the shop treated the 'roles' as wearable items.
You could make a script that gives a player points every round that could make them buy detective or traitor, it would be pretty simple to make but would kind of ruin the randomness of the game in my opinion
The PointShop itself gives points over time. I wanted to make it a possibility to purchase a role. They would be expensive as far as points go to prevent people constantly buying them.
[QUOTE=bilbasio;41702440]You could make a script that gives a player points every round that could make them buy detective or traitor, it would be pretty simple to make but would kind of ruin the randomness of the game in my opinion[/QUOTE]
I personally dislike it, too. Like, imagine if you spend all that time collecting points to be traitor and get RDM'd, you'd be pretty upset.
I think you'd be better off having it just be random
I appreciate the input guys, but all I wanted to know what how to add that function. I've played on a server with it before and we did fine. If it became a problem, I would handle it. It wouldn't hurt to give it a try.
If you insist dude.
This should suit your needs
[CODE]ITEM.Name = 'Traitor'
ITEM.Price = 2000
ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt'
ITEM.OneUse = true
ITEM.AllowedUserGroups = { "donator", "customrank", "admin", "superadmin" }
if SERVER then
local plymeta = FindMetaTable( "Player" )
if not plymeta then return end
plymeta.inTraitorCooldown = false
end
function ITEM:CanPlayerBuy(ply)
return ply.inTraitorCooldown
end
function ITEM:OnEquip(ply, modifications)
hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function()
if ply:GetRoleString() != "traitor" then
ply:SetRole(ROLE_TRAITOR)
ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
end
if SERVER then
ply.inTraitorCooldown = true
timer.Simple(1200, function() ply.inTraitorCooldown = false end)
ply:PS_TakeItem(self.ID)
end
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
end)
end
function ITEM:OnHolster(ply)
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
end
function ITEM:OnSell(ply)
hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor")
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.