Win Points for Winning in TTT

I am not a professional lua coder so I came here to ask if anyone could help me(Not looking to pay)

Gamemode: TTT
Addon: Pointshop by _Undefined

Is it possible to give points (ex. 10) automatically to the winning role (ex. innocent/detective or traitor) but only to the players who are still alive? If so, could you post the code or addon for it please?

I believe this is the code for adding points.


 PS_GivePoints( 25 ) 

You could do a check to see if every player alive is a traitor or innocents and detective. Although I read somewhere that Teams doesn’t work the same way as sandbox. I can’t give much help because I haven’t played TTT enough.

Source: http://forum.facepunch.com/showthread.php?t=1241550

[lua]hook.Add(“TTTEndRound”, “tttlvl.savestats”, function(result)
local players = player.GetAll()

for _, pl in ipairs(players) do
	if pl:IsTerror() then
		if result == WIN_TRAITOR then
                            if pl:IsActiveTraitor() then
			     pl:PS_GivePoints(1337)
                            end
		else
                            if !pl:IsActiveTraitor() then
			     pl:PS_GivePoints(5)
                            end
		end
	end
end

end)[/lua]