You can only buy traitor within the first 30 seconds of the round.

I have this donator plugin on my Pointshop by _Undefined so that you could buy Traitor and Detective, however, the problem is that people buys it like whenever they want which is abusive according to some players, and what I am requesting is a little help from you guys to make this so people could only buy Traitor within the first 30 seconds of the round.

Link to the Pointshop I am using:

http://www.facepunch.com/showthread.php?t=1228438

That kind of plugins gonna drive away your player base, would not recommend.

Well I have already implemented it and it was suggested. If I see any rants about it from my players then I will remove it.

But it is important that I make it so you could only buy either within 30 seconds of round start.

canchooseteam = false
hook.Add(“TTTBeginRound”, function()
canchooseteam = true
timer.Create…
canchooseteam = false
end
end)

Just have it set the bool every round, check it serverside if they can or not.

The rest you can do yourself, no spoonfeeding today.

Agreed. I refuse to implement it on my own server for that same exact reason. It is a cheap way to receive traitor and those who save up a lot of points can repeatedly become traitor, ruining it for others since there is a certain limit for each map.

Trust me I’ve made it so it is not that simple to buy Traitor.

Buying traitor is stupid, when people stop playing who don’t buy traitor, the people who are buying stop playing because they never get the chance to buy traitor since everybody else is trying to. They found an easy, fair solution; randomization. Just stick with it.

Thank you for your opinions on this, though I still would like to know how to make this work.

What’s the problem with you, it’s his fault if he’ll lose his playerbase and what not. He’s asking for help, why don’t you just help him and stop this argument.
[lua]

//Put this above the (serverside) code that lets you buy traitor
local canbuytraitor = false
hook.Add(“TTTBeginRound”, “CanBuyStuff”, function()
canbuytraitor = true
timer.Create(“canbuytraitor”, 30, 1, function()
canbuytraitor = false
end)
end)
hook.Add(“TTTEndRound”, “CanBuyStuffEND”, function()
timer.Remove(“canbuytraitor”)
canbuytraitor = false
end)

if canbuytraitor then
//Buy code here
else
//Warn the player that he can’t buy
end
[/lua]
That code should do it, I can’t give you more since you haven’t shown us what code you already have.

This is my code for buying Traitor:



function ITEM:OnBuy(ply)
	ply:SetRole(ROLE_TRAITOR)
	SendFullStateUpdate()
end

function ITEM:OnSell(ply)
	ply:Kill()
end


Why not make the users buy it during the round preparation, add a limit to the amount of traitors that can be bought. When the traitors get selected, force the players who have bought the role to said role, and then continue on with the code’s life. Simple.
This is how I would personally do it.

Also, I would limit traitor purchases to 25% of possible traitors and make it so you have to wait 2 rounds before you can force traitor again.

If I only knew how to code things like that…