TTT round end pointshop

What am I doing wrong? Sometimes it even says PS_GivePoints is not working either.


hook.Add("TTTEndRound", "tttlvl.savestats", function(result)
	local players = player.GetAll()
		
	for _, pl in ipairs(players) do
		if pl:IsTerror() then -- TEAM TERROR
			if result == WIN_TRAITOR then  -- Traitors win
				if pl:IsActiveTraitor() and pl:Alive() then  -- Player is the traitor and alive will get awarded 15 points.
				     pl:PS_GivePoints(15)
					 pl:ChatPrint("[PS]: You have been awarded 15 points for DEMOLISHING ALL THEM INNOCENTS!")
				elseif pl:IsActiveTraitor() and !pl:Alive() then  -- Player is the traitor and dead will get awarded 8 points.
					 pl:PS_GivePoints(8)
					 pl:ChatPrint("[PS]: You have been awarded 8 points for being apart of the winning team, loser!")
				elseif !pl:IsActiveTraitor() and !pl:Alive() then  -- Player is not traitor and dead will get awarded 5 points.
					 pl:PS_GivePoints(3)
					 pl:ChatPrint("[PS]: You have been awarded 3 points! At least you tried, kind of.")
				end
			elseif result == WIN_INNOCENT then  -- Innocents win
				if !pl:IsActiveTraitor and pl:Alive() then  -- Player is not traitor and alive will get awarded 15 points.
					 pl:PS_GivePoints(10)
					 pl:ChatPrint("[PS]: You have been awarded 10 points FOR DEMOLISHING THEM BACK STABBERS!")
				elseif !pl:IsActiveTraitor() and !pl:Alive() then  -- Player is not traitor and dead will get awarded 5 points.
					 pl:PS_GivePoints(5)
					 pl:ChatPrint("[PS]: You have been awarded 8 points for being apart of the winning team, loser!")
				elseif pl:IsActiveTraitor() and !pl:Alive() then  -- Player is traitor and dead will get awarded 3 points.
					 pl:PS_GivePoints(3)
					 pl:ChatPrint("[PS]: You have been awarded 3 points! You should of Allahu Akbar!")
				end
			elseif result == WINTIMELIMIT  -- Time ran out
				 pl:PS_GivePoints(5)
				 pl:ChatPrint("[PS]: Time ran out! You have been awarded 5 points! Thanks for playing!")
			end
		elseif pl:IsSpec() then -- TEAM SPEC
			pl:ChatPrint("[PS]: You have not been awarded any points because you are in spectator mode!")
		end
	end
end)


Errors:



[ERROR] lua/autorun/winround.lua:12: attempt to call method 'PS_GivePoints' (a nil value)
  1. fn - lua/autorun/winround.lua:12
   2. Call - addons/ulib/lua/ulib/shared/hook.lua:110
    3. RoundStateChange - gamemodes/terrortown/gamemode/cl_init.lua:133
     4. func - gamemodes/terrortown/gamemode/cl_init.lua:204
      5. unknown - lua/includes/extensions/net.lua:32



[ERROR] lua/autorun/winround.lua:18: function arguments expected near 'and'
  1. unknown - lua/autorun/winround.lua:0


The error message is pretty clear, just look at line 18 .-. (Parenthesis)

Also - In the error line 12 refers to PS_GivePoints but that isn’t even on line 12 in your code. However, the line 18 error definitely refers to line 18 in your code (I can only assume you altered the code)

http://forum.facepunch.com/showthread.php?t=1357870&p=43757244&viewfull=1#post43757244

Twas an alter from this guy. I mean I don’t see why though on line 18…

Line 18…


if !pl:IsActiveTraitor and pl:Alive() then  -- Player is not traitor and alive will get awarded 15 points.