If join team?

is there a hook that makes me change playermodel when i join a specific team?

//THANKS ALOT IF YOU HELP

**[Gamemode.OnPlayerChangedTeam

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.OnPlayerChangedTeam)**
inside that do something like

[lua]
if ply:Team == Team_RED then ply:SetModel( “models/player/odessa.mdl” )
[/lua]

doesnt work :frowning:

It works pefectly and if you cant get something simple like that working like this then I suggest you read some lua tutorals

or why cant you just post the code here? :’(

He did…

[editline]10:26AM[/editline]

[lua]function GM:OnPlayerChangedTeam(ply, old, new)
if new == TEAM_RED then
ply:SetModel(“models/player/odessa.mdl”)
end
end[/lua]

Something like that?

What would you learn if I just spoon feed you?

i can code java and its rly confusing when im reading lua tutorials

Having another programming language under your belt should help you with Lua, not make it more confusing. You should already understand the basics.

If you code java lua should be piss easy for you

idk why but lua is just confusing but thanks for helping me , and the code

**function GM:OnPlayerChangedTeam(ply, old, new)
if new == TEAM_TF then
ply:SetModel(“models/player/odessa.mdl”)
end
end **

did not work

Are you doing this for a gamemode?

Also, post any errors the code is causing.

[editline]10:33AM[/editline]

[noparse][lua]code[/lua][/noparse]

there is no errors , but im coding fretta and im still a stupid combine civil protection :confused:

btw what file should i put it in?

Put a print in there to see if it is running.

[lua]
function GM:OnPlayerChangedTeam(ply, old, new)
print(ply:Nick()…" joined team.GetName(new)…".")
if new == TEAM_TF then
ply:SetModel(“models/player/odessa.mdl”)
end
end[/lua]

that fucked up the gamemode :open_mouth:

Yea, I fucked that up. Here you go:

[lua]function GM:OnPlayerChangedTeam(ply, old, new)
print(ply:Nick()…" joined team"…team.GetName(new)…".")
if new == TEAM_TF then
ply:SetModel(“models/player/odessa.mdl”)
end
end[/lua]

i found 3x of this function i searched all the files , im gonna remove them

[editline]09:45AM[/editline]

nope it doesnt work

are you editing the fretta gamemode directly?

yes

You are supposed to derive from fretta.