Advertisement
Guest User

Untitled

a guest
Nov 14th, 2011
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.67 KB | None | 0 0
  1. function RemoveIt(pl, cmd, arg)
  2.  
  3.     if TimerStatus == 1 then
  4.         if pl.SpawnWait < CurTime() then
  5.             if Props[arg[1]] then
  6.                 local tr = util.TraceLine(util.GetPlayerTrace(pl))
  7.                 local ent = ents.Create( "prop_physics" )
  8.                 if ( !ent:IsValid() ) then return end
  9.                 ent:SetModel(arg[1])
  10.                 ent:PhysicsInit( SOLID_VPHYSICS )
  11.                 ent:SetSolid( SOLID_VPHYSICS )
  12.                 ent:SetMoveType( MOVETYPE_VPHYSICS )
  13.                 local Raise = ent:OBBCenter():Distance(ent:OBBMins())
  14.                 ent:SetPos(tr.HitPos + Vector(0, 0, (Raise + 5)))
  15.                 ent:SetNetworkedEntity("Owner", pl)
  16.                 ent:SetNWInt("NAMEY", pl:Name())
  17.                 ent:Spawn()
  18.                 ent:Activate()
  19.                 ent:SetHealth(100000)
  20.                 ent:SetNWInt("PropHealth", Props[arg[1]].HEALTH)
  21.                 --local bone = ent:GetModelPhysBoneCount()
  22.                 local Bone = tr.PhysicsBone
  23.                 if pl:GetNWInt("Cash") >= Props[arg[1]].COST then -- If player cash is greater then the cost of the prop
  24.                     if pl:IsAdmin() -- If the player is an admin
  25.                         if pl:GetNWInt("Props") >= 30 then -- if he has reached the admin prop limit
  26.                         ent:Remove() --remove the prop
  27.                         pl:ChatPrint("You Have Hit the prop limit") --display this messege
  28.                         end            
  29.                     else
  30.                         if pl:GetNWInt("VIP") >= 1 then -- If the player is a vip and an admin
  31.                         pl:SetNWInt("Cash", pl:GetNWInt("Cash") - math.Round(Props[arg[1]].COST * 0.75)) -- purchases the prop at a reduced cost
  32.                         pl:SetNWInt("Props", pl:GetNWInt("Props") + 1)  -- add 1 to the prop count
  33.                     else
  34.                         pl:SetNWInt("Cash", pl:GetNWInt("Cash") - Props[arg[1]].COST) -- if the player is not a vip purchase at regular price
  35.                         pl:SetNWInt("Props", pl:GetNWInt("Props") + 1) -- add 1 to the prop count
  36.                     end
  37.                 else
  38.                     if pl:GetNWInt("Props") == 20 then -- if he has reached the regular player prop limit
  39.                         ent:Remove() --remove the prop if he is over the prop limit
  40.                         pl:ChatPrint("You Have Hit the prop limit") -- display messege
  41.                     end
  42.                 else
  43.                     if pl:GetNWInt("VIP") >= 1 then -- if the player is a vip
  44.                         pl:SetNWInt("Cash", pl:GetNWInt("Cash") - math.Round(Props[arg[1]].COST * 0.75)) -- purchase prop at a discounted price
  45.                         pl:SetNWInt("Props", pl:GetNWInt("Props") + 1) -- add 1 to prop count
  46.                     else
  47.                         pl:SetNWInt("Cash", pl:GetNWInt("Cash") - Props[arg[1]].COST) -- if regular player purchase at regular
  48.                         pl:SetNWInt("Props", pl:GetNWInt("Props") + 1) -- add 1 to prop count
  49.                     end
  50.                 else
  51.                 ent:Remove() -- remove the prop if does not have enough cash
  52.                 pl:ChatPrint("You don't have enough cash!") -- display if player does not have enough cash
  53.                 end
  54.                 end
  55.             pl.SpawnWait = CurTime() + .2
  56.             end
  57.         end
  58.     end
  59. end
  60. concommand.Add( "RemoveIt", RemoveIt )
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement