HeLLFox15

My Lua Problem

May 13th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function waterEffects( ply, ent )
  2.     local waterdmg = DamageInfo()
  3.     waterdmg:SetAttacker(nil)
  4.     waterdmg:SetInflictor(nil)
  5.     waterdmg:SetDamage( math.random(0.5,5) ) --A random number bettween 5 and 10
  6.     waterdmg:SetDamageType( DMG_DROWN ) --Water damage
  7.    
  8.     for k, ply in pairs(player.GetAll()) do
  9.         if ( ply:IsValid() and ply:WaterLevel() >= 3 ) then
  10.             print(ply:Name().." Is under water!")
  11.             timer.Create( "uwater_time", 25, 0, function()
  12.                 print(ply:Name().." Needs Air!")
  13.                 ply:TakeDamageInfo( waterdmg )
  14.                 util.ScreenShake( ply:GetPos(), 5 ,5 ,1.5 ,100 )
  15.                 timer.Stop( "uwater_time" )
  16.             end)
  17.             timer.Start( "uwater_time" )
  18.         else
  19.             timer.Stop( "uwater_time" )
  20.         end
  21.     end
  22. end
  23.  
  24. hook.Add( "Think", "RealisticWaterEffects", waterEffects )
  25.  
  26. function classControl()
  27.  
  28.     defaultTools = { "weapon_toolgun", "camera", "weapon_physgun", "weapon_gravgun"  }
  29.  
  30.     for k, ply in pairs(player.GetAll()) do
  31.         if ( ply:IsSuperAdmin() == false ) then
  32.             if ( ply:Team() == TEAM_PET ) then
  33.                 if ( ply:GetActiveWeapon():GetClass() != "weapon_pounce" or ply:GetActiveWeapon():GetClass() != "weapon_bite" ) then
  34.                     if ( table.HasValue( defaultTools, ply:GetActiveWeapon():GetClass() ) ) then ply:GetActiveWeapon():Remove() else ply:DropWeapon( ply:GetActiveWeapon():GetClass() ) end
  35.                 end
  36.             end    
  37.         end
  38.    
  39.         if ( ply:Team() == TEAM_CPPET ) then
  40.             ply:SetMaterial("models/combine_soldier/combinesoldiersheet")
  41.         else
  42.             ply:SetMaterial("")
  43.         end
  44.        
  45.         local tmb = 7
  46.        
  47.         if ( ply:Team() == TEAM_PET or ply:Team() == TEAM_CPPET ) then
  48.             print(ply:Name().." Is A Pet!")
  49.             timer.Create( "pet_health_time", 7, 0, function()
  50.                 print(ply:Name().." +1")
  51.                 ply:SetHealth(ply:Health() + 1)
  52.                 timer.Stop( "pet_health_time" )
  53.             end)
  54.             timer.Start( "pet_health_time" )
  55.         else
  56.             timer.Stop( "pet_health_time" )
  57.         end
  58.     end
  59.    
  60. end
  61.  
  62. hook.Add( "Think", "PlayerClassControl", classControl )
Advertisement
Add Comment
Please, Sign In to add comment