If I were using: GM:PlayerSpawn( ply )
What would I use to check if player's team is Unassigned / Joining?
[lua]function GM:PlayerSpawn( ply )
if ply:Team() == Joining / Unassigned then -- Unassigned / Joining team?!
ply:ConCommand( "team_1" ) -- send team_1 command
end[/lua]
You normally do not need to check that for any reason...
If that is what the team is stuck to for any reason then its because of an error in your gamemode
I do not wish to use:
[lua]-- PLAYER INITIAL SPAWN --
function GM:PlayerInitialSpawn( ply ) -- initial spawn function
CheckAdministration( ply ) -- the administration checklist
ply:ConCommand( "team_1" ) -- send team_1 command
end -- end of initial spawn[/lua]
I wanted to know if there was a way to check if a player is assigned a team?
And if not then.. something like this? I dont think it would work though.
[lua]-- PLAYER EVERY OTHER SPAWN --
function GM:PlayerSpawn( ply ) -- team models
if ply:Team() == NULL then
ply:ConCommand( "team_1" ) -- send team_1 command
[/lua]
Its just because when I run the initial spawn function, and then the player is listed in my admin.lua it doesnt change their model until they next respawn? Do i have to assign the model in admin.lua to correct the model issue?
Instead of checking for joining or whatever check if they arn't team_1, team_2 ,ect. ect.
Also, What exactly is admin.lua that the player is listed in it?
[QUOTE=DocDoomsday;19794683]Instead of checking for joining or whatever check if they arn't team_1, team_2 ,ect. ect.
Also, What exactly is admin.lua that the player is listed in it?[/QUOTE]
How do I go about that? == null ??
ps_admin.lua
[lua] function CheckAdministration( ply ) -- the administration function
-- Ren
if ( ply:SteamID() == "STEAM_0:1:5334179" ) then -- check steam id
ply:SetTeam( 4 ) -- set team TW
ply:Give( "weapon_crowbar" ) -- crowbar
ply:Give( "gmod_tool" ) -- gmodtool
return
end
end[/lua]
Wait wait wait...thats just to check if its you?
You can do that on initial spawn...just make sure you hook it.
[lua]
hook.Add("PlayerInitialSpawn", function( ply )
if ply:SteamID() == "STEAM_0:1:5334179" then
ply:SetTeam( 4 )
end
end )
hook.Add("PlayerSpawn", function( ply )
if ply:SteamID() == "STEAM_0:1:5334179" then
ply:Give"weapon_crowbar"
ply:Give"gmod_tool"
end
end )
[/lua]
Sorry, you need to Log In to post a reply to this thread.