Ok so im running this on my init.lua
[lua]
function GM:PlayerLoadout( ply )
if ply:Team() == 1 then
ply:Give( "weapon_physcannon" )
ply:SetModel( "models/player/kleiner.mdl" )
elseif ply:Team() == 2 then
ply:SetModel( "models/player/gman_high.mdl" )
ply:Give( "weapon_physcannon" )
end
end
[/lua]
Maybe I need to run it on shared.lua( Edit: Tried shared, it failed) but when I die my charachter model hasnt changed and isnt either of these. Any help?
Have you precached the models? [code]util.PrecacheModel("models/player/kleiner.mdl")[/code]
Ah, no, I wasnt aware I needed to (first gamemode). I presume this goes in either the shared.lua or init.lua header?
Don't set the player model in PlayerLoadout. Set it in PlayerSpawn.
[QUOTE=Yobdren;16141329]Don't set the player model in PlayerLoadout. Set it in PlayerSpawn.[/QUOTE]
Or better yet call it when it is supposed to be called. ;)
[url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSetModel[/url]
Brilliant, problem fixed. Thanks guys. also one last quick question, Is there a way to colour a player (like make kleiner tinted blue) in lua without editing models. Looked through the wiki but couldnt find anything.
[editline]09:10PM[/editline]
[QUOTE=find me;16141402]Or better yet call it when it is supposed to be called. ;)
[url]http://wiki.garrysmod.com/?title=Gamemode.PlayerSetModel[/url][/QUOTE]
Isn't that only if your deriving from sandbox though?
Edit: Maybe not, I dont know at least it works and I will bare this in mind.
[QUOTE=Snipeor;16141562]Brilliant, problem fixed. Thanks guys. also one last quick question, Is there a way to colour a player (like make kleiner tinted blue) in lua without editing models. Looked through the wiki but couldnt find anything.
[editline]09:10PM[/editline]
Isn't that only if your deriving from sandbox though?
Edit: Maybe not, I dont know at least it works and I will bare this in mind.[/QUOTE]
Player:SetColor(255, 255, 200, 255)
Or stick those together the right way:
[i]Player:SetColor( 200, 200, 255, 255 )[/i]
[editline]04:25PM[/editline]
entity.SetColor accepts four arguments: r, g, b, and a. It does not accept color structures.
[QUOTE=Snipeor;16141562]Isn't that only if your deriving from sandbox though?
Edit: Maybe not, I dont know at least it works and I will bare this in mind.[/QUOTE]
As a note the answer to your question so you definitely know: No.
It is not Sandbox specific.
Great, thankyou all.
Sorry, you need to Log In to post a reply to this thread.