Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. Item = { Name, Descripton, Type, DisplayItem, Owner}
  2.  
  3. ItemTypes =
  4. {
  5.     Weapon = 0,
  6.     Food = 1,
  7.     Medical = 2,
  8.     Ammo = 3,
  9.     Clothing = 4,
  10.     Attachment = 5,
  11. };
  12.  
  13. if SERVER then
  14.     function Item.Drop(ply)
  15.        
  16.     end
  17.  
  18.     function Item.Delete()
  19.    
  20.     end
  21.    
  22.     function Item.Spawn(X,Y)
  23.         local ent = ents.Create("prop_physics")
  24.         local ang = Vector(0,0,1):Angle();
  25.         ang.pitch = ang.pitch + 90;
  26.         ang:RotateAroundAxis(ang:Up(), math.random(0,360))
  27.         ent:SetAngles(ang)
  28.         ent:SetModel(Item.Path)
  29.         local pos = Vector(X,Y,0)
  30.         pos.z = pos.z - ent:OBBMaxs().z
  31.         ent:SetPos( pos )
  32.         ent:Spawn()
  33.     end
  34. end
  35.  
  36. function Item.New(name,descr,typ,ditem)
  37.     Item.Name = name
  38.     Item.Descripton = descr
  39.     Item.Type = typ
  40.     Item.DisplayItem = ditem
  41.     return Item
  42. end
  43.  
  44. function Item.SetUser(ply)
  45.     Item.Owner = ply
  46.     Item.DisplayItem.SetUser(ply)
  47. end
  48.  
  49. if CLIENT then
  50.     function Item.GetDisplayItem()
  51.         return Item.DisplayItem
  52.     end
  53. end
  54.  
  55.     function Item.IsWeapon()
  56.         return Item.Type == ItemTypes.Weapon
  57.     end
  58.    
  59.     function Item.IsFood()
  60.         return Item.Type == ItemTypes.Food
  61.     end
  62.    
  63.     function Item.IsMedical()
  64.         return Item.Type == ItemTypes.Medical
  65.     end
  66.    
  67.     function Item.IsAmmo()
  68.         return Item.Type == ItemTypes.Ammo
  69.     end
  70.    
  71.     function Item.IsClothing()
  72.         return Item.Type == ItemTypes.Clothing
  73.     end
  74.    
  75.     function Item.IsAttachment()
  76.         return Item.Type == ItemTypes.Attachment
  77.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement