teamGetClass returning nil?

I am trying to get the players darkrp class and its returning nil instead of TEAM_WHATEVER.

Here is my code :slight_smile:



function ENT:Use(activator, caller)
	if team.GetClass(caller:Team()) == "TEAM_HOBO" then
		print("DEBUG SHIT")
	end
end


Oh and how do I make it to where when I USE this entity, it doesn’t spam DEBUG SHIT as I press it?

team.GetClass returns a table, not a string.
One of these might work:



if caller:Team() == "TEAM_HOBO" then




if caller:Team() == TEAM_HOBO then


Team() returns the index, not the class.

Why is it called TEAM_HOBO if it’s a class?

I dont even know if its called Class, I am just trying to return the players TEAM_JOB thingy.

[editline]20th November 2017[/editline]

Oh wait :expressionless: I think I was doing it wrong

[editline]20th November 2017[/editline]

Well now I am confused for why this isnt working :?




Teams = {TEAM_HOBO, TEAM_MAYOR}

for k, v in pairs(Teams) do 
	if caller:Team() == v then
		net.Start("message1")
			net.WriteEntity(caller)
		net.Send(caller)
	else
		net.Start("message2")
			net.WriteEntity(caller)
		net.Send(caller)
	end
end



This calls both net messages for some reason

[editline]20th November 2017[/editline]

Well I was just using bad code, I fixed it using this guide. Thanks for the help!