Hook/Function messed up

Hi, i am trying to make a Hitmenu Popup like a hud when you change teams. BUT for some reason the hitmenu hud doesnt show up until i change to a hitman, Then to a different job. it wont work if i just change to a hitman, it only works when i change FROM a hitman to something else. Please help

Server


hook.Add("OnPlayerChangedTeam", "HitmanList", function(ply)
    net.Start("cn_hitmanList");
    net.Send(ply);
end)

Client


net.Receive("cn_hitmanList", function(ply)
if (LocalPlayer():Team() == TEAM_HITMAN) then
		createHitList();
end;
end);

You do for DarkRP?

Try wrapping it in a timer that executes after one or two seconds and see if it works then.

[LUA]
hook.Add(“OnPlayerChangedTeam”, “HitmanList”, function(ply)
net.Start(“cn_hitmanList”)
net.Send(ply)
end)
[/LUA]
[LUA]
net.Receive(“cn_hitmanList”, function(ply)
timer.Simple(1,function()
if (ply:Team() == TEAM_HITMAN) then
createHitList()
end
end)
end)
[/LUA]

Could just be that the message is getting sent before the player’s team is changed, I’ve had stuff like that happen before

Which would make sense if you see the menu after you switch from hitman, which would mean there is a delay of some sort there :v:

You might also want to check the player’s team serverside before sending the message to open the hitmenu as well

Thanks, and i have a check on the hitmenu as well. thanks for your help. One other thing. I believe that the hitmenu will no longer refresh when someone places a hit, they have to change teams to see new hits. How would i put a refresh?