How do I set a team's playermodel, I did this in shared
[lua]
team.SetUp( 1, "Blue Team", Color( 0, 0, 255, 255 ) )
team.SetSpawnPoint(1, "info_player_terrorist")
team.SetSpawnPoint(2, " info_player_counterterrorist")
team.SetModel(1, "models/player/halo3/spartan_blue.mdl")
team.SetModel(2, "models/player/halo3/spartan_red.mdl")
team.SetUp( 2, "Red Team", Color( 225, 0, 0 , 225 ) )
util.PrecacheModel( "models/player/halo3/spartan_red.mdl" )
util.PrecacheModel( "models/player/halo3/spartan_blue.mdl" )
[/lua]
and this in init
[lua]
function team_1( ply )
ply:SetModel( "models/player/halo3/spartan_blue.mdl" )
ply:SetTeam( 1 ) //Make the player join team 1
ply:Spawn()
end
function team_2( ply )
ply:SetModel( "models/player/halo3/spartan_red.mdl" )
ply:SetTeam( 2 ) //Make the player join team 2
ply:Spawn()
end
[/lua]
And I also added it to GM:PlayerLoadout
But still no luck :/
What's the correct way?
EDIT:
When you swap teams from red to blue you keep red skin, how do I fix this? would I have to like remove their model then add another or?... I'm stuck
There's a hook named GM:PlayerSetModel that might be overriding the model. Also, you first call team.SetUp and only after that you call team.SetSpawnPoint, etc functions. ( You are setting up second team after you set their model etc )
I don't have GM:PlayerSetModel anywhere and creating this function
[lua]
function GM:PlayerSetModel( ply )
if ply:Team == 1 then
ply:SetModel( "models/player/halo3/spartan_red.mdl" )
elseif ply:Team == 2 then
ply:SetModel( "models/player/halo3/spartan_blue.mdl" )
end
end
[/lua]
When adding that to init.lua crashes gamemode,
The directory to models are correct
And i changed shared to
[lua]
team.SetUp( 1, "Blue Team", Color( 0, 0, 255, 255 ) )
team.SetUp( 2, "Red Team", Color( 225, 0, 0 , 225 ) )
team.SetSpawnPoint(1, "info_player_terrorist")
team.SetSpawnPoint(2, " info_player_counterterrorist")
team.SetModel(1, "models/player/halo3/spartan_blue.mdl")
team.SetModel(2, "models/player/halo3/spartan_red.mdl")
[/lua]
Crashes it?
[QUOTE=Robotboy655;42336079]Crashes it?[/QUOTE]
Makes it a base gamemode
:Team( ) ==
[QUOTE=Kogitsune;42336206]:Team( ) ==[/QUOTE]
OMG I can't believe it, I forgot, holy crap, I was so confused, I can't believe I forgot that, thanks so much
Working code for those wondering
init.lua
[lua]
function GM:PlayerSetModel( ply )
if ply:Team() == 1 then
ply:SetModel( "insertmodel1" )
elseif ply:Team() == 2 then
ply:SetModel( "insertmodel2" )
end
end
[/lua]
[editline]28th September 2013[/editline]
Okay, the problem is, when someone changes team, they keep there old team skin
if red team changes to blue team he keeps red team skin, how do i fix this?
[editline]28th September 2013[/editline]
NVM
Sorry, you need to Log In to post a reply to this thread.