I've seem to run into another issue with this script, it's not loading when the server starts up :/
Here is what I've put into lua/autorun/server
job_table = {TEAM_CITIZEN, TEAM_HOBO, TEAM_BUILDER, TEAM_KINGHOBO, TEAM_BANKER, TEAM_MEDIC, TEAM_SECURITYGUARD, TEAM_BODYGUARD} // Job labels, for the job script
local jobCount = table.Count(job_table)
local randomJob = math.random(1, jobCount)
Msg("Random Job loaded successfully.")
for _, ply in pairs( player.GetAll() ) do
if (ply:Team() == TEAM_DEFAULTED ) then
timer.Create("randomJob" ..ply:UserID(), 120, 1, function()
ply:changeTeam( job_table[randomJob], true)
ply:PrintMessage(HUD_PRINTCENTER, "Your job has been auto-selected")
end)
end
end
Yet after 2 minutes if the player is still the under the team "TEAM_DEFAULTED" they are not switched to a random job
Any suggestions? I'm completely lost as to why it's not automatically working.