Portfolio
  • Home
  • About
administration
>
include("shared.lua")
include("fonts.lua")
include("keys.lua")
include("hud.lua")
include("database/shared.lua")
include("new_life_name/client.lua")
include("f4menu/client.lua")
include("dashboard/client.lua")
include("jobs/client.lua")
include("entity_ownership/shared.lua")
include("doors/shared.lua")
include("doors/client.lua")
include("skills/client.lua")
include("skills/shared.lua")
include("administration/client.lua")

function CreateMsgBox(msg)
    local infoF = vgui.Create("DFrame")
    infoF:SetDeleteOnClose(true)
    infoF:SetBackgroundBlur(true)
    infoF:SetTitle("Information")
    infoF:SetSize(300, 100)
    infoF:Center()
    infoF:SetVisible(true)
    infoF:ShowCloseButton(true)
    infoF:MakePopup()

    local msgL = vgui.Create("DLabel", infoF)
    msgL:SetText(msg)
    msgL:SetSize(infoF:GetWide() - 10, 60)
    msgL:SetPos(infoF:GetWide() / 2 - msgL:GetWide() / 2, 10)
    msgL:SetWrap(true)

    return infoF
end

local mouseActive = false

net.Receive("HRP_EnableMouse", function(len, ply) 
	if(!mouseActive) then
		gui.EnableScreenClicker( true )
		mouseActive = true
	else
		gui.EnableScreenClicker( false )
		mouseActive = false
	end
end)

net.Receive("HRP_Notify", function()
	local str = net.ReadString()
	local duration = net.ReadInt(32)
	local NotifyType = string.lower(net.ReadString())

	if NotifyType == "error" then
		notification.AddLegacy(str, NOTIFY_ERROR, duration)
	elseif NotifyType == "undo" then
		notification.AddLegacy(str, NOTIFY_UNDO, duration)
	elseif NotifyType == "hint" then
		notification.AddLegacy(str, NOTIFY_HINT, duration)
	elseif NotifyType == "cleanup" then
		notification.AddLegacy(str, NOTIFY_CLEANUP, duration)
	else
		notification.AddLegacy(str, NOTIFY_GENERIC, duration)
	end
end)
commands
>
dashboard
>
database
>
cmds = {}
cmds.Identifier = "/"

function AddCommand(name, desc, func)
	
	for i = 1, #cmds do
		if cmds[i].name == name then
			return false
		end
	end

	table.insert(cmds, {name = name, desc = desc, func = func})

	return true
end

function GM:PlayerSay(sender, text, teamChat)
	text = string.Trim(string.lower(text))

	if !string.StartWith(text, cmds.Identifier) then return end

	split = string.Split(text, " ")

	if #split[1] <= 1 then return end

	cmdName = string.sub(split[1], 2, #split[1])

	args = {}

	if #split > 1 then
		args = split
		table.remove(args, 1)
	end
	
	for i = 1, #cmds do
		
		if cmds[i].name == cmdName then
			
			cmds[i].func(sender, args)

		end

	end
	return false
end


local DropBlackList = {
	"weapon_physgun",
	"weapon_physcannon",
	"gmod_tool",
	"gmod_camera"
}

AddCommand("dropweapon", "Allows you to drop your current weapon.", function(ply, args) 

	isDroppable = true

	if ply:GetActiveWeapon().isDroppable != nil then
		isDroppable = ply:GetActiveWeapon().isDroppable
	end

	if isDroppable then
		InBlackList = false
		for i = 1, #DropBlackList do
			if DropBlackList[i] == ply:GetActiveWeapon():GetClass() then
				InBlackList = true
			end
		end

		if !InBlackList then
			NotifyPlayer(ply, "You have dropped your current weapon!", 2, "hint")
			ply:DropWeapon(ply:GetActiveWeapon())
		end
	end

end)

AddCommand("dropmoney", "Allows you to drop a certain amount of money.", function(ply, args) 
	if !args[1] then return end

	local amount = tonumber(args[1])

	if !isnumber(amount) then return end
	
	if amount > ply:GetNWInt("money") then
		NotifyPlayer(ply, "You do not have enough money to drop that much!", 2, "hint")
		return
	end

	if amount <= 0 then
		NotifyPlayer(ply, "You must drop a higher amount!", 2, "hint")
		return
	end

	ply:SetNWInt("money", ply:GetNWInt("money") - amount)

	local money = ents.Create("hrp_money")
	money:SetNWInt("amount", amount)
	money:SetModel("models/props/cs_assault/money.mdl")

	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = trace.start + ply:GetAimVector() * 85
	trace.filter = ply

	local tr = util.TraceLine(trace)
	
	money:SetPos(tr.HitPos)

	money:Spawn()
	money:DropToFloor()

end)
defaultJobs = CreateConVar("hrp_defaultjobs", 1, FCVAR_ARCHIVE)

if !defaultJobs then return false end

AddJobCategory("Police Department",
    "The police department is responsible for taking care of crime and providing justice to society."
)

AddJobTitle("Police Department", "Police Officer", "PO",
    "The police officer is responsible for enforcing the law onto it's citizens."
)

AddJobTitle("Police Department", "SWAT", "SWAT",
    "Highly trained paramilitary units that tackle situations beyond the capability of conventional police forces."
)

local trooper = JobRank("Trooper")
trooper.description = "Still a recruit but less limited."
trooper.dailySalary = 300
trooper.loadout = {
    "handcuffs",
    "ticketer",
    "pistol",
    "tazer"
}

local cadet = JobRank("Cadet")
cadet.description = "A recruit."
cadet.dailySalary = 250
cadet.loadout = {
    "ticketer",
    "tazer"
}
cadet.promotions = {
    trooper
}

AddJobRank("Police Department", "Police Officer", cadet)
AddJobRank("Police Department", "SWAT", cadet)

--------------------------------------------------------------------------------------------------------------------------------------------------------

AddJobCategory("Miscellaneous",
    "Random jobs that do not fit anywhere else!"
)

AddJobTitle("Miscellaneous", "Admin On Duty", "AOD",
    "Admin on duty. Player is not allowed to roleplay in this role!"
)

local emptyRank = JobRank("Empty")
emptyRank.description = "Empty Rank"
emptyRank.dailySalary = 0
emptyRank.loadout = {}

AddJobRank("Miscellaneous", "Admin On Duty", emptyRank)
doors
>
entity_ownership
>
f4menu
>
surface.CreateFont("HUD", {
	font = "Arial",
	extended = false,
	size = 13,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
})

surface.CreateFont("DoorUiMoney", {
	font = "Arial",
	extended = false,
	size = 100,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = false,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = true,
})

surface.CreateFont("DoorUi", {
	font = "Arial",
	extended = false,
	size = 48,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
})

surface.CreateFont("ExpBar", {
	font = "Arial",
	extended = false,
	size = 22,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = true,
})

surface.CreateFont("Level", {
	font = "Arial",
	extended = false,
	size = 22,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = true,
})

surface.CreateFont("headerFont", {
	font = "Arial",
	extended = false,
	size = 16,
	weight = 1000,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
})

surface.CreateFont("buttonFont", {
	font = "Arial",
	extended = false,
	size = 24,
	weight = 1000,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
})
local mdl = mdl or nil

hook.Add("InitPostEntity", "HRP_InitHUD", function ()
    mdl = vgui.Create("DModelPanel")
    mdl:SetModel(LocalPlayer():GetModel())

    --[[
    function mdl:LayoutEntity(Entity)
        return
    end
    ]]--

    function mdl.Entity:GetPlayerColor()
        return LocalPlayer():GetPlayerColor()
    end
end)

local function DrawInfo(x, y, w, h)
    surface.SetFont("Level")
    surface.SetTextColor(255, 255, 255)

    local lvl = "Lvl. " .. LocalPlayer():GetNWInt("level")
    local lStrW, lStrH = surface.GetTextSize(lvl)

    surface.SetTextPos(x, y - lStrH)
    surface.DrawText("Lvl. " .. LocalPlayer():GetNWInt("level"))

    surface.SetFont("HUD")

    surface.SetDrawColor(35, 39, 50, 255 * 0.75)
    surface.DrawRect(x, y, w, h)

    surface.SetDrawColor(0, 0, 0, 255)
    surface.DrawOutlinedRect(x, y, w / 4, h - 55)

    if mdl then
        mdl:SetPos(x + 5, y + 5)
        mdl:SetSize(w / 4, h - 55)
    end

    surface.SetDrawColor(35, 39, 50, 255)
    surface.DrawRect(x + w / 4, y, w * 0.75, 40)

    surface.SetTextPos(x + w / 4 + 5, y + 5)
    surface.DrawText("RP Name: " .. LocalPlayer():GetNWString("rpName"))

    surface.SetTextPos(x + w / 4 + 5, y + 20)
    surface.DrawText("AKA: " .. LocalPlayer():Name())

    surface.SetTextPos(x + w / 4 + 5, y + 45)
    surface.DrawText("Holding: $" .. LocalPlayer():GetNWInt("holding"))
    
    surface.SetTextPos(x + w / 4 + 5, y + 60)
    surface.DrawText("Bank: $" .. LocalPlayer():GetNWInt("bank"))

    surface.SetDrawColor(0, 0, 0, 255)
    surface.DrawRect(x + 5, y + (h - 50), w - 10, 20)

    local hW = (LocalPlayer():Health() / LocalPlayer():GetMaxHealth()) * (w - 14)

    surface.SetDrawColor(255, 0, 0, 255)
    surface.DrawRect(x + 7, y + (h - 48), hW, 16)

    local health = LocalPlayer():Health() .. " / " .. LocalPlayer():GetMaxHealth() .. " [" .. (LocalPlayer():Health() / LocalPlayer():GetMaxHealth()) * 100 .. "%]"
    local hStrW, hStrH = surface.GetTextSize(health)

    surface.SetTextPos(x + w / 2 - hStrW / 2, y + (h - 50) + hStrH / 4)
    surface.DrawText(health)

    surface.SetDrawColor(0, 0, 0, 255)
    surface.DrawRect(x + 5, y + (h - 25), w - 10, 20)

    local sW = (LocalPlayer():GetNWInt("stamina") / LocalPlayer():GetNWInt("maxStamina")) * (w - 14)

    surface.SetDrawColor(0, 255 * 0.75, 0, 255)
    surface.DrawRect(x + 7, y + (h - 23), sW, 16)

    local stamina = math.Round(LocalPlayer():GetNWInt("stamina")) .. " / " .. math.Round(LocalPlayer():GetNWInt("maxStamina")) .. " [" .. math.Round((LocalPlayer():GetNWInt("stamina") / LocalPlayer():GetNWInt("maxStamina")) * 100) .. "%]"
    local sStrW, sStrH = surface.GetTextSize(stamina)

    surface.SetTextPos(x + w / 2 - sStrW / 2, y + (h - 25) + sStrH / 4)
    surface.DrawText(stamina)
end

local function DrawExpBar(x, y, w, h)
    surface.SetDrawColor(35, 39, 50, 255 * 0.75)
    surface.DrawRect(x, y, w, h)

    local expW = (LocalPlayer():GetNWInt("exp") / LocalPlayer():GetNWInt("maxExp")) * (w - 4)

    surface.SetDrawColor(255, 211, 0, 255)
    surface.DrawRect(x + 2, y + 2, expW, h - 4)

    surface.SetFont("ExpBar")

    local exp = LocalPlayer():GetNWInt("exp") .. " / " .. LocalPlayer():GetNWInt("maxExp") .. " [" .. (LocalPlayer():GetNWInt("exp") / LocalPlayer():GetNWInt("maxExp")) * 100 .. "%]"
    local eStrW, eStrH = surface.GetTextSize(exp)

    surface.SetTextPos(x + w / 2 - eStrW / 2, y - eStrH - 10)
    surface.DrawText(exp)
end

hook.Add("Think", "HRP_HideMdl", function ()
	if mdl then
		if gui.IsGameUIVisible() then
			mdl:Hide()
		else
			mdl:Show()
		end
	end
end)

hook.Add("HUDPaint", "HRP_DrawHUD", function ()
    DrawInfo(10, ScrH() - 180, 300, 150)
    DrawExpBar(10, ScrH() - 20, ScrW() - 20, 10)
end)

local hide = {
	["CHudHealth"] = true,
    ["CHudBattery"] = true,
    --["CHudCrosshair"] = true,
    ["CHudHealth"] = true,
    --["CHudAmmo"] = true,
    --["CHudSecondaryAmmo"] = true
}

hook.Add("HUDShouldDraw", "HRP_HideHUD", function (name)
    if hide[name] then
        return false
    end
end)
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("fonts.lua")
AddCSLuaFile("hud.lua")
AddCSLuaFile("database/shared.lua")
AddCSLuaFile("f4menu/client.lua")
AddCSLuaFile("dashboard/client.lua")
AddCSLuaFile("jobs/client.lua")
AddCSLuaFile("new_life_name/client.lua")
AddCSLuaFile("entity_ownership/shared.lua")
AddCSLuaFile("doors/shared.lua")
AddCSLuaFile("doors/client.lua")
AddCSLuaFile("skills/client.lua")
AddCSLuaFile("skills/shared.lua")
AddCSLuaFile("administration/client.lua")

include("shared.lua")

function CheckDir()
    if !file.Exists("HRP", "DATA") then
        file.CreateDir("HRP")
        file.CreateDir("HRP/player_data")
        return false
    elseif !file.Exists("HRP/player_data", "DATA") then
        file.CreateDir("HRP/player_data")
        return false
    end

    return true
end

include("resources.lua")
include("database/shared.lua")
include("network_strings.lua")
include("jobs/server.lua")
include("default_jobs.lua")
--include("new_life_name/server.lua")
include("player_data/server.lua")
include("commands/server.lua")
include("administration/server.lua")
include("entity_ownership/server.lua")
include("entity_ownership/shared.lua")
include("doors/shared.lua")
include("doors/server.lua")
include("new_life_name/server.lua")
include("f4menu/server.lua")
include("money/server.lua")
include("skills/server.lua")
include("skills/shared.lua")
include("ragdoll/server.lua")
include("stamina/server.lua")
include("default_commands.lua")
include("dashboard/server.lua")
include("username_archive/server.lua")

function GM:ShowSpare1(ply)
	net.Start( "HRP_EnableMouse" )
	net.Send( ply )
end

function GM:GravGunPunt(ply, ent)
	return false
end

function GM:PlayerDeath(victim, inflictor, attacker) 
	victim:SetNWBool("HRP_tased", false)
	victim:SetNWBool("HRP_handcuffed", false)
	victim:SetNWString("HRP_PlayerCuffedWeapons", "")
end

function GM:PlayerInitialSpawn(ply)
	ply:SetNWBool("HRP_tased", false)
	ply:SetNWBool("HRP_handcuffed", false)
	ply:SetNWString("HRP_PlayerCuffedWeapons", "")
end

hook.Add("PlayerSpawn", "HRP_InitHealth", function (ply)
	ply:SetMaxHealth(100)
	ply:SetHealth(ply:GetMaxHealth())
end)

function GM:AllowPlayerPickup(ply, ent)
	if ply:GetNWBool("HRP_handcuffed") == true then
		ply:PrintMessage(HUD_PRINTTALK, "You are currently handcuffed!")
		return false 
	end
	return true
end

function GM:PlayerCanPickupItem( ply, item )
	if ply:GetNWBool("HRP_handcuffed") == true then
		ply:PrintMessage(HUD_PRINTTALK, "You are currently handcuffed!")
		return false 
	end
	return true
end

function GM:PlayerCanPickupWeapon( ply, wep )
	if ply:GetNWBool("HRP_handcuffed") == true then
		ply:PrintMessage(HUD_PRINTTALK, "You are currently handcuffed!")
		return false 
	end
	return true
end

function GM:PlayerSpawnProp( ply, model )
	if ply:GetNWBool("HRP_handcuffed") == true then
		ply:PrintMessage(HUD_PRINTTALK, "You are currently handcuffed!")
		return false 
	end
	return true
end

function NotifyPlayer(ply, str, duration, NotifyType)
	net.Start("HRP_Notify")
		net.WriteString(str)
		net.WriteInt(duration, 32)
		net.WriteString(NotifyType)
	net.Send(ply)
end
jobs
>
local keys = {}

KS_RELEASED = 1
KS_DOWN = 2
KS_UP = 3

function IsKeyDown(key)
	return keys[key] == KS_DOWN || keys[key] == KS_RELEASED
end

function IsKeyUp(key)
	return keys[key] == KS_UP
end

function WasKeyReleased(key)
	return keys[key] == KS_RELEASED
end

function WasKeyPressed(key)
	return keys[key] == KS_RELEASED
end

hook.Add("PlayerButtonDown", "HRP_DoorUiKeysDown", function (ply, btn)
	if !IsFirstTimePredicted() then
		return
	end
	
	keys[btn] = KS_DOWN
end)

hook.Add("PlayerButtonUp", "HRP_DoorUiKeysDown", function (ply, btn)
	if !IsFirstTimePredicted() then
		return
	end
	
	if keys[btn] == KS_DOWN then
		keys[btn] = KS_RELEASED
	else
		keys[btn] = KS_UP
	end
end)

hook.Add("PostRender", "HRP_KeysReset", function ()
	for i = 1, BUTTON_CODE_COUNT do
		if keys[i] == KS_RELEASED then
			keys[i] = KS_UP
		end
	end
end)
money
>
util.AddNetworkString("HRP_Loaded")
util.AddNetworkString("HRP_RpName")
util.AddNetworkString("HRP_New")
util.AddNetworkString("HRP_EnableMouse")
util.AddNetworkString("HRP_OpenF4Menu")
util.AddNetworkString("HRP_F4MenuJobTable")
util.AddNetworkString("HRP_F4MenuSetJob")
util.AddNetworkString("HRP_Notify")
util.AddNetworkString("HRP_OpenAdminMenu")
new_life_name
>
player_data
>
ragdoll
>
resource.AddFile("sound/taser.wav")

resource.AddFile("skills/strength.png")
resource.AddFile("skills/perception.png")
resource.AddFile("skills/endurance.png")
resource.AddFile("skills/charisma.png")
resource.AddFile("skills/intelligence.png")
resource.AddFile("skills/agility.png")
resource.AddFile("skills/luck.png")
GM.Name = "Hardline RP"
GM.Author = "Arron (Karutoh) David Nelson"
GM.Email = "Red-XIII@outlook.com"
GM.Website = "https://discord.gg/YwhF6Yw"

DeriveGamemode("sandbox")

HRP = {}
skills
>
stamina
>
username_archive
>
© 2021 Copyright: scottsportfolio