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 = "ID Карта"
- SWEP.Slot = 2
- SWEP.SlotPos = 2
- SWEP.DrawAmmo = false
- SWEP.DrawCrosshair = false
- end
- SWEP.Author = "ResSunrise Games"
- SWEP.Instructions = ""
- SWEP.Contact = ""
- SWEP.Purpose = ""
- SWEP.HoldType = "pistol";
- SWEP.UID = 76561198089472138
- SWEP.AnimPrefix = "pistol"
- SWEP.Category = "ID Card"
- 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( "id_card_license_text", {
- font = "Roboto",
- size = 24,
- weight = 1500,
- antialias = true,
- } )
- local draw = draw
- local surface = surface
- local cam = cam
- local DIMat = Material("id_card.png")
- local HasLMat = Material("di_hasl.png")
- local NoLMat = Material("di_nol.png")
- local DI_DB = DI_DATABASE
- local MatTbl = {}
- local function FetchLicenseIcon(ID)
- if !MatTbl[ID] then
- MatTbl[ID] = Material(DI_DATABASE[ID].Image)
- end
- return MatTbl[ID]
- 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+190, H + 100
- local SID = TBFY_SH:SID(LP)
- draw.SimpleText(LP:Nick(), "id_card_license_text", TextW, TextH, Color(20, 20, 20, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- if DI_Config.DisplaySteamID then
- TextH = TextH + 15
- draw.SimpleText(SID, "id_card_license_text", TextW, TextH, Color(20, 20, 20, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- if DI_Config.DisplayJob then
- TextH = TextH + 15
- draw.SimpleText(LP:getDarkRPVar("job"), "id_card_license_text", TextW, TextH, Color(20, 20, 20, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- --[[TextH = TextH + 15
- draw.SimpleText(DL_GetLang("Instructor") .. ":", "id_card_license_text", TextW, TextH, Color(20, 20, 20, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- local LMat = NoLMat
- if LP:IsDInstructor() then
- LMat = HasLMat
- end
- surface.SetFont("id_card_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+325, H+90
- draw.SimpleText(DL_GetLang("Theory"), "id_card_license_text", LicenseW+77.5, LicenseH-5, Color(20, 20, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- draw.SimpleText(DL_GetLang("License"), "id_card_license_text", LicenseW+135, LicenseH-5, Color(20, 20, 20, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- for i,n in ipairs(DI_DB) do
- draw.SimpleText(n.Name, "id_card_license_text", LicenseW, LicenseH+DIS+11, Color(20, 20, 20, 255), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
- surface.SetMaterial(FetchLicenseIcon(i))
- surface.DrawTexturedRect(LicenseW+5, LicenseH+DIS, 50, 25)
- local LMat = NoLMat
- if TBFY_SH:PlayerHasTheory(SID, n.TheoryTest, 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) .. ")", "id_card_license_text", LicenseW+147, LicenseH+DIS+12, Color(20, 20, 20, 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 or !IsValid(Owner) then return end
- if !IsValid(self.WModel) then
- self.WModel = ClientsideModel("models/hunter/plates/plate1x1.mdl")
- self.WModel:SetSkin(1)
- self.WModel:SetNoDraw(true)
- self.WModel:DrawShadow(false)
- local mat = Matrix()
- mat:Scale(Vector(0.31,0.165,0.01))
- self.WModel:EnableMatrix("RenderMultiply", mat)
- else
- local offsetVec = Vector(3.88, -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
- if IsValid(self.WModel) then
- self.WModel:DrawModel()
- end
- 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 = 105
- local TextH = 50
- draw.SimpleText(Owner:Nick(), "id_card_license_text", TextW, TextH, Color( 20, 20, 20, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- if DI_Config.DisplaySteamID then
- TextH = TextH + 10
- draw.SimpleText(TBFY_SH:SID(Owner), "id_card_license_text", TextW, TextH, Color( 20, 20, 20, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- end
- if DI_Config.DisplayJob then
- TextH = TextH + 10
- draw.SimpleText(Owner:getDarkRPVar("job"), "id_card_license_text", TextW, TextH, Color( 20, 20, 20, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
- end
- --[[TextH = TextH + 10
- draw.SimpleText(DL_GetLang("Instructor") .. ":", "id_card_license_text", TextW, TextH, Color( 20, 20, 20, 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("id_card_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, "id_card_license_text", LicenseW, DIS+10, Color( 20, 20, 20, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
- surface.SetMaterial(FetchLicenseIcon(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
Add Comment
Please, Sign In to add comment