Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Category = "Perryn's Ported Vehicles"
- local V = {
- // Required information
- Name = "Ford F700 Armored Rob",
- Class = "prop_vehicle_jeep",
- Category = Category,
- // Optional information
- Author = "Perryn",
- Information = "Drive Carefully",
- Model = "models/perrynsvehicles/Ford_F700_Armored/Ford_F700_Armored.mdl",
- KeyValues = {
- vehiclescript = "scripts/vehicles/perryn/Ford_F700_Armored.txt"
- }
- }
- list.Set( "Vehicles", "perryn_Ford_F700_Armored_rob", V )
- if SERVER then
- hook.Add("OnEntityCreated","F770Armored",function(ent)
- timer.Simple(.1, function()
- if not IsValid(ent) then return end
- if ent:GetModel()=="models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl"
- then ent.Button=ents.Create("kx_button")
- ent.Button:SetPos(ent:LocalToWorld(Vector(0, -160, 76.3)))
- ent.Button:SetVehicle(ent)
- ent.Button:SetAngles(ent:LocalToWorldAngles(Angle(90, -90, 0)))
- ent.Button:Spawn()
- end
- end)
- end)
- local bboxmins, bboxmaxs = Vector(-50, -50, -50), Vector(50, 50, 50)
- hook.Add("Tick", "F770_DoRobbery", function()
- for k, ent in ipairs(ents.FindByModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")) do
- if ent.STOLEN then continue end
- local tr = util.TraceHull({
- start = ent:LocalToWorld(Vector(0, -60, 75)),
- endpos = ent:LocalToWorld(Vector(0, -60, 75)),
- filter = ent,
- mins = bboxmins,
- maxs = bboxmaxs,
- })
- local ply = tr.Entity
- if not ply:IsPlayer() then continue end
- if not INCCONFIG.Jobs[ply:Team()] then continue end
- ply.RobTime = ply.RobTime or CurTime()
- if ply.RobTime <= CurTime() then
- ply.RobberingTime = !ply.RobberingTime and 0 or ply.RobberingTime + 1
- if ply.RobberingTime >= INCCONFIG.RobberyTime then
- ply.RobberingTime = 0
- ent.STOLEN = true
- local money = math.random(INCCONFIG.MinMoney, INCCONFIG.MaxMoney)
- ply:setDarkRPVar("money", ply:getDarkRPVar("money") + money)
- ply:ChatPrint("Вы получили "..string.Comma(money).."!")
- timer.Simple(INCCONFIG.RespawnTime, function()
- if IsValid(ent) then ent:Remove() end
- local car = ents.Create("prop_vehicle_jeep")
- car:SetModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")
- car:SetPos(INCCONFIG.SpawnPos)
- car:SetAngles(INCCONFIG.SpawnAng)
- car:SetKeyValue("vehiclescript","scripts/vehicles/perryn/Ford_F700_Armored.txt")
- car:SetVehicleClass( "perryn_Ford_F700_Armored_rob" )
- car:Spawn()
- car:Activate()
- car:SetSkin(INCCONFIG.SpawnSkin or 0)
- local dv = ents.Create("npc_decentvehicle")
- dv:SetPos(car:GetPos())
- dv:Spawn()
- dv:Activate()
- end)
- end
- ply:SetNWInt("RobberingTime", ply.RobberingTime)
- ply.RobTime = CurTime() + 1
- end
- end
- for k, ply in ipairs(player.GetAll()) do
- if not ply.RobTime then continue end
- if (CurTime()-ply.RobTime) > 0 then
- ply:SetNWInt("RobberingTime", -1)
- ply.RobberingTime = -1
- end
- end
- end)
- hook.Add("InitPostEntity", "SpawnFirstFord", function()
- local car = ents.Create("prop_vehicle_jeep")
- car:SetModel("models/perrynsvehicles/ford_f700_armored/ford_f700_armored.mdl")
- car:SetPos(INCCONFIG.SpawnPos)
- car:SetAngles(INCCONFIG.SpawnAng)
- car:SetKeyValue("vehiclescript","scripts/vehicles/perryn/Ford_F700_Armored.txt")
- car:SetVehicleClass( "perryn_Ford_F700_Armored_rob" )
- car:Spawn()
- car:Activate()
- car:SetSkin(INCCONFIG.SpawnSkin or 0)
- local dv = ents.Create("npc_decentvehicle")
- dv:SetPos(car:GetPos())
- dv:Spawn()
- dv:Activate()
- end)
- else
- local ourMat = INCCONFIG.Marker and Material(INCCONFIG.Marker) or nil
- hook.Add("HUDPaint", "PaintRobberyHUD", function()
- local ply = LocalPlayer()
- if not IsValid(ply) or not ply:Alive() then return end
- if ply:isCP() then
- if LASTRobbery then
- for k, v in pairs(LASTRobbery) do
- local pos = v:ToScreen()
- draw.SimpleText(INCCONFIG.RobbingText, INCCONFIG.Font, pos.x, pos.y, color_black, 1, 1)
- draw.SimpleText(INCCONFIG.RobbingText, INCCONFIG.Font, pos.x+1, pos.y+1, Color(200,0,0), 1, 1)
- if not ourMat then continue end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( ourMat ) -- If you use Material, cache it!
- surface.DrawTexturedRect( pos.x-32, pos.y+25, 64, 64 )
- end
- end
- return
- end
- local time = INCCONFIG.RobberyTime-ply:GetNWInt("RobberingTime")
- if time > INCCONFIG.RobberyTime then return end
- draw.SimpleText(string.format(INCCONFIG.RobText, time), INCCONFIG.Font, (ScrW()/2)+2, 52, color_black, 1, 1)
- draw.SimpleText(string.format(INCCONFIG.RobText, time), INCCONFIG.Font, ScrW()/2, 50, INCCONFIG.Color, 1, 1)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement