Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. local Category = "Perryn's Ported Vehicles"
  2.  
  3. local V = {
  4. // Required information
  5. Name = "Ford F700 Armored Rob",
  6. Class = "prop_vehicle_jeep",
  7. Category = Category,
  8.  
  9. // Optional information
  10. Author = "Perryn",
  11. Information = "Drive Carefully",
  12. Model = "models/perrynsvehicles/Ford_F700_Armored/Ford_F700_Armored.mdl",
  13.  
  14. KeyValues = {
  15. vehiclescript = "scripts/vehicles/perryn/Ford_F700_Armored.txt"
  16. }
  17. }
  18.  
  19. list.Set( "Vehicles", "perryn_Ford_F700_Armored_rob", V )
  20.  
  21. if SERVER then
  22. hook.Add("OnEntityCreated","F770Armored",function(ent)
  23. timer.Simple(.1, function()
  24. if not IsValid(ent) then return end
  25. if ent:GetModel()=="models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl"
  26. then ent.Button=ents.Create("kx_button")
  27. ent.Button:SetPos(ent:LocalToWorld(Vector(0, -160, 76.3)))
  28. ent.Button:SetVehicle(ent)
  29. ent.Button:SetAngles(ent:LocalToWorldAngles(Angle(90, -90, 0)))
  30. ent.Button:Spawn()
  31. end
  32. end)
  33. end)
  34.  
  35. local bboxmins, bboxmaxs = Vector(-50, -50, -50), Vector(50, 50, 50)
  36. hook.Add("Tick", "F770_DoRobbery", function()
  37. for k, ent in ipairs(ents.FindByModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")) do
  38. if ent.STOLEN then continue end
  39. local tr = util.TraceHull({
  40. start = ent:LocalToWorld(Vector(0, -60, 75)),
  41. endpos = ent:LocalToWorld(Vector(0, -60, 75)),
  42. filter = ent,
  43. mins = bboxmins,
  44. maxs = bboxmaxs,
  45. })
  46. local ply = tr.Entity
  47. if not ply:IsPlayer() then continue end
  48. if not INCCONFIG.Jobs[ply:Team()] then continue end
  49. ply.RobTime = ply.RobTime or CurTime()
  50. if ply.RobTime <= CurTime() then
  51. ply.RobberingTime = !ply.RobberingTime and 0 or ply.RobberingTime + 1
  52. if ply.RobberingTime >= INCCONFIG.RobberyTime then
  53. ply.RobberingTime = 0
  54.  
  55. ent.STOLEN = true
  56. local money = math.random(INCCONFIG.MinMoney, INCCONFIG.MaxMoney)
  57.  
  58. ply:setDarkRPVar("money", ply:getDarkRPVar("money") + money)
  59.  
  60. ply:ChatPrint("Вы получили "..string.Comma(money).."!")
  61.  
  62. timer.Simple(INCCONFIG.RespawnTime, function()
  63. if IsValid(ent) then ent:Remove() end
  64. local car = ents.Create("prop_vehicle_jeep")
  65. car:SetModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")
  66. car:SetPos(INCCONFIG.SpawnPos)
  67. car:SetAngles(INCCONFIG.SpawnAng)
  68. car:SetKeyValue("vehiclescript","scripts/vehicles/perryn/Ford_F700_Armored.txt")
  69. car:SetVehicleClass( "perryn_Ford_F700_Armored_rob" )
  70. car:Spawn()
  71. car:Activate()
  72. car:SetSkin(INCCONFIG.SpawnSkin or 0)
  73.  
  74. local dv = ents.Create("npc_decentvehicle")
  75. dv:SetPos(car:GetPos())
  76. dv:Spawn()
  77. dv:Activate()
  78. end)
  79. end
  80. ply:SetNWInt("RobberingTime", ply.RobberingTime)
  81. ply.RobTime = CurTime() + 1
  82. end
  83. end
  84. for k, ply in ipairs(player.GetAll()) do
  85. if not ply.RobTime then continue end
  86. if (CurTime()-ply.RobTime) > 0 then
  87. ply:SetNWInt("RobberingTime", -1)
  88. ply.RobberingTime = -1
  89. end
  90. end
  91. end)
  92. hook.Add("InitPostEntity", "SpawnFirstFord", function()
  93. local car = ents.Create("prop_vehicle_jeep")
  94. car:SetModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")
  95. car:SetPos(INCCONFIG.SpawnPos)
  96. car:SetAngles(INCCONFIG.SpawnAng)
  97. car:SetKeyValue("vehiclescript","scripts/vehicles/perryn/Ford_F700_Armored.txt")
  98. car:SetVehicleClass( "perryn_Ford_F700_Armored_rob" )
  99. car:Spawn()
  100. car:Activate()
  101. car:SetSkin(INCCONFIG.SpawnSkin or 0)
  102.  
  103. local dv = ents.Create("npc_decentvehicle")
  104. dv:SetPos(car:GetPos())
  105. dv:Spawn()
  106. dv:Activate()
  107. end)
  108. else
  109. local ourMat = INCCONFIG.Marker and Material(INCCONFIG.Marker) or nil
  110. hook.Add("HUDPaint", "PaintRobberyHUD", function()
  111. local ply = LocalPlayer()
  112. if not IsValid(ply) or not ply:Alive() then return end
  113. if ply:isCP() then
  114. if LASTRobbery then
  115. for k, v in pairs(LASTRobbery) do
  116. local pos = v:ToScreen()
  117. draw.SimpleText(INCCONFIG.RobbingText, INCCONFIG.Font, pos.x, pos.y, color_black, 1, 1)
  118. draw.SimpleText(INCCONFIG.RobbingText, INCCONFIG.Font, pos.x+1, pos.y+1, Color(200,0,0), 1, 1)
  119.  
  120. if not ourMat then continue end
  121. surface.SetDrawColor( 255, 255, 255, 255 )
  122. surface.SetMaterial( ourMat ) -- If you use Material, cache it!
  123. surface.DrawTexturedRect( pos.x-32, pos.y+25, 64, 64 )
  124. end
  125. end
  126. return
  127. end
  128. local time = INCCONFIG.RobberyTime-ply:GetNWInt("RobberingTime")
  129. if time > INCCONFIG.RobberyTime then return end
  130. draw.SimpleText(string.format(INCCONFIG.RobText, time), INCCONFIG.Font, (ScrW()/2)+2, 52, color_black, 1, 1)
  131. draw.SimpleText(string.format(INCCONFIG.RobText, time), INCCONFIG.Font, ScrW()/2, 50, INCCONFIG.Color, 1, 1)
  132. end)
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement