Advertisement
Silverlan

Untitled

Mar 24th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1.  local function IsReallyValid(ent)
  2.     return ent:IsValid() && ent.VehicleType == VEHICLE_TANK && (!SERVER || (ent:GetPhysicsObject():IsValid() && ent.HasParts))
  3. end
  4.  
  5.  
  6. function TOOL:LeftClick( trace )
  7.     local ent = trace.Entity
  8.     if(!IsReallyValid(ent)) then
  9.         if(!ent:IsValid()) then return false end
  10.         ent = ent:GetOwner()
  11.         if(!IsReallyValid(ent)) then return false end
  12.     end
  13.     if(CLIENT) then return true end
  14.     if(ValidEntity(ent.Tower)) then ent.Tower:SetBodygroup(1,self:GetClientNumber("turret")) end
  15.     if(ValidEntity(ent.Barrel)) then ent.Barrel:SetBodygroup(1,self:GetClientNumber("gun")) end
  16.     return true
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement