• Calling function returns
    5 replies, posted
So I set up my pointshop so you get points for killing Ts as innos, innos as ts, and vice versa, complete with detectives, removal of points and stuff like that. Only thing I've got a problem with right now, is that you still get and get points removed for postround dm. I tried to do it like this: [CODE] function IsMidRound() hook.Add("TTTBeginRound", "StartThePVP", function() midround = true end ) hook.Add("TTTEndRound", "EndThePVP", function() midround = false end ) return midround end [/CODE] then start the other part with [CODE] if killer:IsPlayer() && IsMidRound() then [/CODE] I would also like to add a part where you get like 2 points per kill made in postround dm. [CODE] if killer:IsPlayer() && IsMidRound() == false then killer:PS_GivePoints(2) killer:PS_Notify("You've been given 2 points for killing someone postround!") end [/CODE] It works just fine if I don't call the IsMidRound(), so I just need help getting this smalllll bit to work. Currently, nothing will happen, most likely meaning IsMidRound() is returning false, and that's what I need help with.
I would suggest you read through TTT's code. [lua] local r = GetRoundState() if r == ROUND_POST or r == ROUND_PREP then --do stuff end [/lua]
Is there a state for ROUND_MID, or something similar?
[code]if r ~= ROUND_END and r ~= ROUND_PREP then --Mid round end[/code]
ROUND_ACTIVE
These are all the variables for rounds, found in shared.lua: [lua] -- Round status consts ROUND_WAIT = 1 ROUND_PREP = 2 ROUND_ACTIVE = 3 ROUND_POST = 4 [/lua]
Sorry, you need to Log In to post a reply to this thread.