• [DarkRP] Starting jobs off with armor
    1 replies, posted
I was trying this : [CODE]hook.Add("PlayerSpawn", function(ply) if ply:Team() == TEAM_POLICE then ply:SetArmor( 25 ) elseif ply:Team() == TEAM_CHIEF then ply:SetArmor( 25 ) elseif ply:Team() == TEAM_MAYOR then ply:SetArmor( 15 ) elseif ply:Team() == TEAM_SWAT then ply:SetArmor( 50 ) elseif ply:Team() == TEAM_SWATCOMMAND then ply:SetArmor( 50) else ply:SetArmor( 0 ) end end)[/CODE] As a script in autorun, but it doesn't seem to work. Any ideas?
Use google: [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd8ca.html"]hook.Add[/URL] Example: [lua] function onThink() //this is the bogus function's body, this function does nothing :/ end hook.Add( "Think", "Some unique name", onThink ) [/lua] Result: You're missing the Unique name part. [lua] hook.Add("PlayerSpawn", "CustomTeamArmor", function(ply) if ply:Team() == TEAM_POLICE then ply:SetArmor( 25 ) elseif ply:Team() == TEAM_CHIEF then ply:SetArmor( 25 ) elseif ply:Team() == TEAM_MAYOR then ply:SetArmor( 15 ) elseif ply:Team() == TEAM_SWAT then ply:SetArmor( 50 ) elseif ply:Team() == TEAM_SWATCOMMAND then ply:SetArmor( 50) else ply:SetArmor( 0 ) end end) [/lua]
Sorry, you need to Log In to post a reply to this thread.