Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- HSP LCD File output plugin
- ]]
- local LCDEnabled = CreateConVar("lcd_enabled", 1, true, false)
- local LCDFile = "writelcd.txt"
- local LastUsedWeaponClass = "No Kills"
- local TotalKills = 0
- local Buff1 = "Buffer 1 fuckup\n"
- local Buff2 = "Buffer 2 fuckup\n"
- local Buff3 = "Buffer 3 fuckup\n"
- local Buff4 = "Buffer 4 fuckup\n"
- local NiceWeaponNames = {
- ["npc_grenade_frag"] = "Frag Grenade",
- ["ent_mad_c4"] = "C4 Bomb",
- ["weapon_sniper"] = "HL2 Beta Sniper",
- ["weapon_pistol"] = "Pistol",
- ["weapon_crowbar"] = "Crowbar",
- ["weapon_357"] = ".357 Magnum",
- ["weapon_smg1"] = "SMG",
- ["weapon_ar2"] = "Frag Grenade",
- ["weapon_rpg"] = "Missile",
- ["rpg_missile"] = "Missile",
- ["worldspawn"] = "The Floor",
- ["prop_physics"] = "Something hard",
- ["prop_physics_multiplayer"] = "Something hard",
- ["weapon_shotgun"] = "Shotgun",
- ["npc_tripmine"] = "Tripmine",
- ["weapon_slam"] = "Tripmine",
- ["npc_satchel"] = "Satchel charge",
- ["prop_vehicle_prisoner_pod"] = "A Chair",
- ["prop_vehicle_jeep"] = "A car",
- ["prop_vehicle_jalopy"] = "A car",
- ["prop_vehicle_airboat"] = "Airboat",
- ["env_explosion"] = "Kaboom!",
- ["weapon_twitch_g3"] = "Twitch G3",
- ["weapon_twitch_awp"] = "Twitch AWP",
- ["weapon_stunstick"] = "Stunstick",
- ["gravestone"] = "Gravestone (!?)",
- ["crossbow_bolt"] = "Crossbow",
- ["weapon_crossbow"] = "Crossbow",
- ["prop_combine_ball"] = "Conbine Ball",
- ["weapon_twitch_ak47"] = "Twitch AK-47",
- ["weapon_ak47"] = "CSS AK-47",
- ["gmod_turret"] = "GMod Turret",
- ["npc_turret_floor"] = "NPC Turret",
- ["npc_portalturret_floor"] = "Portal Turret",
- ["weapon_galil"] = "CSS Galil",
- ["weapon_ioncannon"] = "Ion Cannon",
- ["weapon_fiveseven"] = "CSS FiveSeveN",
- ["kh_smg"] = "KH SMG",
- ["grenade_ar2"] = "SMG Grenade",
- ["weapon_deagle"] = "CSS Deagle",
- ["plasma_smg"] = "Plasma SMG",
- ["weapon_tmp"] = "CSS TMP",
- ["weapon_knife"] = "CSS Knife",
- ["weapon_mp5"] = "CSS MP5",
- ["weapon_p90"] = "CSS P-90",
- ["bullet_grenade"] = "Bullet Grenade",
- ["plasma_rifle"] = "Plasma Rifle",
- ["weapon_twitch_m1014"] = "Twitch M1014",
- ["sent_plasma"] = "Plasma Bomb",
- ["weapon_para"] = "CSS M249",
- ["boomstick"] = "BOOMSTICK!",
- ["weapon_twitch_aug"] = "Twitch AUG",
- ["weapon_twitch_hl2357"] = "Twitch .357",
- ["hunter_flechette"] = "Flechettes",
- ["weapon_twitch_sg550"] = "Twitch SG550",
- ["weapon_twitch_m4"] = "Twitch M16",
- ["weapon_twitch_scout"] = "Twitch Scout",
- ["weapon_stridercannon"] = "Strider Cannon",
- ["suicide_deagle"] = "Suicide Deagle",
- ["weapon_g3"] = "CSS G3",
- ["entityflame"] = "Fire",
- ["env_fire"] = "Fire",
- ["weapon_m4"] = "CSS M16",
- ["weapon_pumpshotgun"] = "CSS Shotgun",
- ["weapon_twitch_deagle"] = "Twitch Deagle",
- ["weapon_twitch_p90"] = "Twitch P-90",
- ["weapon_famas"] = "CSS Famas",
- ["weapon_sniper"] = "lolololol",
- --["weapon_sniper"] = "lolololol",
- --["weapon_sniper"] = "lolololol",
- --["weapon_sniper"] = "lolololol",
- --["weapon_sniper"] = "lolololol",
- --["weapon_sniper"] = "lolololol",
- --[[
- HHHHHHHHHHHHHHH
- ]]
- }
- local AlsoInclude = {
- "rpdm",
- "gtfo",
- "gmdm",
- }
- local DontInclude = {
- "wal",
- "hex",
- }
- local function FixMapName(str)
- str = str:gsub("_", " ")
- str = str:gsub("-", " ")
- local result = ""
- for word in string.gmatch(str, "%S+") do
- local first = string.sub(word,1,1)
- result = (result..string.upper(first)..string.lower(string.sub(word,2)).." ")
- end
- str = result:Trim()
- local tab = string.Explode(" ",str)
- for k,v in pairs(tab) do
- if (table.HasValue(AlsoInclude, v:lower()) or string.len(v) <= 3) and (not table.HasValue(DontInclude, v:lower())) then
- --print("!: ", k)
- tab[k] = v:upper()
- --print(tab[k])
- end
- end
- str = table.concat(tab, " ")
- --PrintTable(tab)
- --print("! return: ", str )
- return str:Trim()
- end
- local function GetLastUsedWeapon(ply,killer,dmginfo)
- TotalKills = TotalKills + 1
- local weapon = dmginfo:GetInflictor()
- if ( weapon and weapon == killer and (weapon:IsPlayer() or weapon:IsNPC()) ) then --get weapon
- weapon = weapon:GetActiveWeapon()
- if ( !weapon or weapon == NULL ) then weapon = killer end
- end
- if (killer == ply) then
- LastUsedWeaponClass = "Suicide"
- return
- end
- LastUsedWeaponClass = weapon:GetClass():lower()
- return
- end
- hook.Add("DoPlayerDeath", "LCDGetLastUsedWeapon", GetLastUsedWeapon)
- local function LCDBuffer()
- if not LCDEnabled:GetBool() then
- return "WriteLCD\nDisabled"
- end
- Buff1 = Format("Plyrs: %s/%s Ents: %s\n", #player.GetHumans(), MaxPlayers(), #ents.GetAll() )
- Buff2 = Format("Map: %s\n", FixMapName(game.GetMap()) )
- Buff3 = Format("Wep: %s\n", NiceWeaponNames[LastUsedWeaponClass] or LastUsedWeaponClass )
- Buff4 = Format("HAC: %s/%s Deaths: %s\n", HAC.TotalBans or 0, HAC.TotalHacks or 0, TotalKills or "None" )
- return Buff1..Buff2..Buff3..Buff4
- end
- local function WriteLCD()
- file.Write(LCDFile, LCDBuffer() )
- end
- timer.Create("WriteLCD", 2, 0, WriteLCD)
- local function WriteLCDShutdown()
- Buff1 = "SRCDS Shutting down\n / \nChanging levels\n"
- file.Write(LCDFile, Buff1)
- end
- hook.Add("ShutDown", "WriteLCDShutdown", WriteLCDShutdown)
- local function KillLCD(ply,cmd,args)
- if not ply:IsAdmin() then return end
- timer.Destroy("WriteLCD")
- file.Write(LCDFile, "sv_WriteLCD Disabled")
- ply:PrintMessage(HUD_PRINTCONSOLE, "LCD: Killed\n")
- end
- concommand.Add("lcd_kill", KillLCD)
- local function RestartLCD(ply,cmd,args)
- if not ply:IsAdmin() then return end
- include("HSP/server/sv_WriteLCD.lua")
- ply:PrintMessage(HUD_PRINTCONSOLE, "LCD: Restarted\n")
- end
- concommand.Add("lcd_reload", RestartLCD)
- local function RestartLCD(ply,cmd,args)
- ply:PrintMessage(HUD_PRINTCONSOLE, "\n"..LCDBuffer().."\n" )
- end
- concommand.Add("lcd_print", RestartLCD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement