Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile("shared.lua")
- end
- if CLIENT then
- SWEP.PrintName = "Водительские Права"
- SWEP.Slot = 2
- SWEP.SlotPos = 2
- SWEP.DrawAmmo = false
- SWEP.DrawCrosshair = false
- end
- SWEP.Author = "ToBadForYou"
- SWEP.Instructions = ""
- SWEP.Contact = ""
- SWEP.Purpose = ""
- SWEP.HoldType = "pistol";
- SWEP.WorldModel = "models/hunter/plates/plate1x1.mdl";
- SWEP.UID = 76561198089472138
- SWEP.AnimPrefix = "pistol"
- SWEP.Category = "ToBadForYou"
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = true
- SWEP.Primary.ClipSize = -1
- SWEP.Primary.DefaultClip = 0
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = ""
- SWEP.Secondary.ClipSize = -1
- SWEP.Secondary.DefaultClip = 0
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.Ammo = ""
- function SWEP:Initialize() self:SetHoldType("pistol") end
- function SWEP:CanPrimaryAttack ( ) return false; end
- function SWEP:CanSecondaryAttack ( ) return false; end
- function SWEP:PreDrawViewModel(vm)
- return true
- end
- if CLIENT then
- surface.CreateFont( "driving_license_text", {
- font = "Verdana",
- size = 12,
- weight = 1000,
- antialias = true,
- } )
- local draw = draw
- local surface = surface
- local cam = cam
- local DIMat = Material("drivinglicenseframe_new.png")
- local HasLMat = Material("di_hasl.png")
- local NoLMat = Material("di_nol.png")
- local DI_DB = DI_DATABASE
- local MatTbl = {}
- for k,v in pairs(DI_DB) do
- MatTbl[k] = Material(v.Image)
- end
- local DI_Config = TBFYDIConfig
- function SWEP:DrawHUD()
- local LW, LH = 500, 250
- local W,H = ScrW()-LW-5, ScrH()-LH-5
- local LP = LocalPlayer()
- LP.PIcon = LP.PIcon or vgui.Create( "ModelImage")
- LP.PIcon:SetSize(146,144)
- LP.PIcon:SetModel(LP:GetModel())
- surface.SetMaterial(DIMat)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawTexturedRect(W, H, LW, LH)
- LP.PIcon:SetPos(W+25,H+71)
- LP.PIcon:SetPaintedManually(false)
- LP.PIcon:PaintManual()
- LP.PIcon:SetPaintedManually(true)
- local TextW,TextH = W+175, H + 75
- draw.SimpleText(LP:Nick(), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- if DI_Config.DisplaySteamID then
- TextH = TextH + 15
- draw.SimpleText(LP:SteamID(), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- if DI_Config.DisplayJob then
- TextH = TextH + 15
- draw.SimpleText(LP:getDarkRPVar("job"), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- TextH = TextH + 15
- draw.SimpleText(DL_GetLang("Instructor") .. ":", "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- local LMat = NoLMat
- if LP:IsDInstructor() then
- LMat = HasLMat
- end
- surface.SetFont("driving_license_text")
- local TW, TH = surface.GetTextSize(DL_GetLang("Instructor") .. ":")
- surface.SetMaterial(LMat)
- surface.DrawTexturedRect(TextW+TW+5, TextH-2.5, 10, 10)
- local DIS = 0
- local CS = 5
- local LicenseW, LicenseH = W+349, H+70
- draw.SimpleText(DL_GetLang("Theory"), "driving_license_text", LicenseW+70.5, LicenseH-6, Color( 0, 0, 0, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- draw.SimpleText(DL_GetLang("License"), "driving_license_text", LicenseW+120, LicenseH-6, Color( 0, 0, 0, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- for i,n in ipairs(DI_DB) do
- draw.SimpleText(n.Name, "driving_license_text", LicenseW, LicenseH+DIS+11, Color( 0, 0, 0, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
- surface.SetMaterial(MatTbl[i])
- surface.DrawTexturedRect(LicenseW+17, LicenseH+DIS, 50, 25)
- local LMat = NoLMat
- if LP:DPassedTheoryTest(i) then
- LMat = HasLMat
- end
- surface.SetMaterial(LMat)
- surface.DrawTexturedRect(LicenseW+75, LicenseH+CS+2, 12, 12)
- local LMat = NoLMat
- if LP:HasDLicense(i) then
- LMat = HasLMat
- end
- surface.SetMaterial(LMat)
- surface.DrawTexturedRect(LicenseW+130, LicenseH+CS+2, 12, 12)
- if DI_Config.DisplayPoints then
- draw.SimpleText("(" .. LP:GetDILicensePoints(i) .. ")", "driving_license_text", LicenseW+147, LicenseH+DIS+12, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- DIS = DIS + 25
- CS = CS + 25
- end
- end
- function SWEP:DrawWorldModel()
- local LPlayer = LocalPlayer()
- local Owner = self.Owner
- if LPlayer == Owner then return end
- if !IsValid(self.WModel) then
- self.WModel = ClientsideModel(self.WorldModel)
- self.WModel:SetSkin(1)
- self.WModel:SetNoDraw(true)
- local mat = Matrix()
- mat:Scale(Vector(0.31,0.165,0.01))
- self.WModel:EnableMatrix("RenderMultiply", mat)
- elseif IsValid(Owner) then
- local offsetVec = Vector(3.95, -8.35, -1.7)
- local offsetAng = Angle(175, 90, 90)
- local boneid = Owner:LookupBone("ValveBiped.Bip01_R_Hand")
- if !boneid then return end
- local matrix = Owner:GetBoneMatrix(boneid)
- if !matrix then return end
- local newPos, newAng = LocalToWorld( offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles() )
- self.WModel:SetPos( newPos )
- self.WModel:SetAngles( newAng )
- self.WModel:SetupBones()
- end
- self.WModel:DrawModel()
- if LPlayer:GetPos():Distance(Owner:GetPos()) < 500 then
- local boneindex = Owner:LookupBone("ValveBiped.Bip01_R_Hand")
- local PonyOverride = false
- if !boneindex then
- boneindex = Owner:LookupBone("LrigNeck1")
- PonyOverride = true
- end
- if boneindex then
- local CurM = Owner:GetModel()
- if !self.PIcon then
- self.PIcon = vgui.Create( "ModelImage")
- self.PIcon:SetSize(90,93)
- self.PIcon:SetPos(12,45)
- self.PIcon:SetModel(CurM)
- self.PIcon:SetPaintedManually(true)
- self.PIconLastM = CurM
- elseif CurM != self.PIconLastM then
- self.PIcon:SetModel(CurM)
- self.PIconLastM = CurM
- end
- local HPos, HAng = Owner:GetBonePosition(boneindex)
- if !PonyOverride then
- HAng:RotateAroundAxis(HAng:Forward(), -90)
- HAng:RotateAroundAxis(HAng:Right(), -90)
- HAng:RotateAroundAxis(HAng:Up(), 5)
- HPos = HPos + HAng:Up()*4 + HAng:Right()*-5 + HAng:Forward()*1
- else
- HAng:RotateAroundAxis(HAng:Forward(), -90)
- HAng:RotateAroundAxis(HAng:Right(), -30)
- HAng:RotateAroundAxis(HAng:Up(), -90)
- HPos = HPos + HAng:Up()*6 + HAng:Forward()*-7
- end
- cam.Start3D2D(HPos, HAng, 1)
- surface.SetMaterial(DIMat)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawTexturedRect(0, 0, 15, 8)
- cam.End3D2D()
- cam.Start3D2D(HPos, HAng, .05)
- self.PIcon:PaintManual()
- local TextW = 80
- local TextH = 60
- draw.SimpleText(Owner:Nick(), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- if DI_Config.DisplaySteamID then
- TextH = TextH + 10
- draw.SimpleText(Owner:SteamID(), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- end
- if DI_Config.DisplayJob then
- TextH = TextH + 10
- draw.SimpleText(Owner:getDarkRPVar("job"), "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- end
- TextH = TextH + 10
- draw.SimpleText(DL_GetLang("Instructor") .. ":", "driving_license_text", TextW, TextH, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- local LMat = NoLMat
- if Owner:IsDInstructor() then
- LMat = HasLMat
- end
- local TW, TH = surface.GetTextSize(DL_GetLang("Instructor") .. ":")
- surface.SetFont("driving_license_text")
- surface.SetMaterial(LMat)
- surface.DrawTexturedRect(TextW+TW+5, TextH-2.5, 10, 10)
- local LicenseW = 225
- local DIS = 35
- local CS = 40
- for i,n in ipairs(DI_DB) do
- draw.SimpleText(n.Name, "driving_license_text", LicenseW, DIS+10, Color( 0, 0, 0, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
- surface.SetMaterial(MatTbl[i])
- surface.DrawTexturedRect(LicenseW+5, DIS, 40, 20)
- local LMat = NoLMat
- if Owner:HasDLicense(i) then
- LMat = HasLMat
- end
- surface.SetMaterial(LMat)
- surface.DrawTexturedRect(LicenseW+50, CS, 12, 12)
- DIS = DIS + 20
- CS = CS + 20
- end
- cam.End3D2D()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement