Ulysses

General => Developers Corner => Topic started by: Bite That Apple on June 21, 2014, 12:49:35 PM

Title: Player:SetTeam() Not Working?
Post by: Bite That Apple on June 21, 2014, 12:49:35 PM
So, I'm remaking one of my gamemodes, and I'm starting from scratch redoing everything. I've now run into an issue with setting teams.

Code: [Select]
-- Create Teams From Database
function CreateTeams()

local CreateTeamInfoAll = sql.Query( "SELECT * FROM apple_tdm_teamcreation19" )
if CreateTeamInfoAll == nil then return end
for k, v in pairs( CreateTeamInfoAll ) do
team.SetUp(tonumber(v['ID']), tostring(v['Name']), Color(tonumber(v['CRed']),tonumber(v['CGreen']),tonumber(v['CBlue']),255), true)
util.PrecacheModel( tostring(v['Models']) )
end
PrintTable(team.GetAllTeams( ))
end


Basically in there, it grabs the teams from the database, and turns it into teams. Well that works all fine and well, but when I try to set team to one of the IDs, it works fine which you're most likely thinking well then what's the issue? Well the issue here is that the team doesn't really "set" or something, it shows it set the team, I made a command to check what team, and name of team I am on, and that works, but it's not setting colour, or name of team IG (sui_scoreboard or chattags addon), but in console its showing I'm in that team...

Any suggestions?
Title: Re: Player:SetTeam() Not Working?
Post by: Cobalt on June 21, 2014, 02:41:19 PM
Are you spawning players with self.BaseClass:PlayerSpawn()?
Title: Re: Player:SetTeam() Not Working?
Post by: Bite That Apple on June 22, 2014, 03:19:40 AM
Are you spawning players with self.BaseClass:PlayerSpawn()?


No, spawning them with GM:PlayerInitialSpawn(ply). If anyone wants the entire gamemode (it's really nothing atm), then you can see for yourself. The gamemode is entirely commented, so you'll be able to see what it does, and you'll see what I mean by it not working correctly.


http://puu.sh/9Ew2h/94986a5016.zip (http://puu.sh/9Ew2h/94986a5016.zip)
Title: Re: Player:SetTeam() Not Working?
Post by: Bite That Apple on June 23, 2014, 08:39:09 AM
Alright, so I found something interesting, and still doesn't work. I'll be looking into this, and I'll record the issue so you can see it for yourself, and find out why it's not working.
Title: Re: Player:SetTeam() Not Working?
Post by: Bite That Apple on June 23, 2014, 11:22:09 AM
Alright, this is the new code here:
http://www.puu.sh/9GRB1/dfe6c555fb.zip (http://www.puu.sh/9GRB1/dfe6c555fb.zip)

That is everything, and it should be working, I spoke to many people now trying to find out why it does this, and no one can answer me... if anyone can help me thanks guys. WATCH THIS VIDEO, this will explain the issue I am having, and it will make more sense. Watch in HD, or you won't see the code

https://www.youtube.com/watch?v=8d66TYrwT-c (https://www.youtube.com/watch?v=8d66TYrwT-c)
Title: Re: Player:SetTeam() Not Working?
Post by: Bite That Apple on June 23, 2014, 02:47:46 PM
Resolved
Title: Re: Player:SetTeam() Not Working?
Post by: Cobalt on June 23, 2014, 02:54:54 PM

No, spawning them with GM:PlayerInitialSpawn(ply). If anyone wants the entire gamemode (it's really nothing atm), then you can see for yourself. The gamemode is entirely commented, so you'll be able to see what it does, and you'll see what I mean by it not working correctly.


http://puu.sh/9Ew2h/94986a5016.zip (http://puu.sh/9Ew2h/94986a5016.zip)
No, I meant like how you handle the actual spawning of players. But you got it sorted out so it's all good.
For instance, here's how I do it in my init.lua (look at GM:PlayerSpawn): http://puu.sh/9Hb9B/735fd41d19.lua (http://puu.sh/9Hb9B/735fd41d19.lua)