Code:
if (CLIENT) then
PropSecure = {}
// Message
function PropSecure.Message(Message)
local T = Message:ReadShort()
local M = Message:ReadString()
// Sound
local Sound = "ambient/water/drip2.wav"
// Type
if (T == 1) then
Sound = "buttons/button10.wav"
elseif (T == 2) then
Sound = "buttons/button17.wav"
elseif (T == 3) then
Sound = "buttons/bell1.wav"
elseif (T == 4) then
Sound = "ambient/machines/slicer"..math.random(1, 4)..".wav"
end
// Notify
GAMEMODE:AddNotify(M, T, 10)
// Play sound
surface.PlaySound(Sound)
end
usermessage.Hook("PropSecure.Message", PropSecure.Message)
// Context menu
hook.Add("PopulateToolMenu", "BuildMyControlPanel",
function()
spawnmenu.AddToolMenuOption("Utilities","User","PropSecure","PropSecure","","",PropSecure.Menu, {} )
end
);
// Menu
function PropSecure.Menu(Panel)
Panel:ClearControls()
Panel:AddControl("Header", {Text = "PropSecure", Description = "PropSecure"})
Panel:AddControl("Button", {Text = "Buddies", Command = "propsecure_buddies"})
Panel:AddControl("Button", {Text = "Share Entity", Command = "propsecure_playershared"})
Panel:AddControl("Button", {Text = "Administration", Command = "propsecure_administration"})
end
// GUI
function PropSecure.GUI()
local Trace = util.GetPlayerTrace(LocalPlayer())
// Trace
local TR = util.TraceLine(Trace)
// Entity
if (TR.Entity) then
local Owner = TR.Entity:GetNetworkedString("Owner")
// Owner
if (Owner != "") then
// Text
local Text = "Owner: "..Owner
// Set font
surface.SetFont("Default")
// Width and height
local W, H = surface.GetTextSize(Text)
W = W + 24
// Box
draw.RoundedBox(4, ScrW() - (W + 8), 32, W, 26, Color(0, 0, 0, 175))
// Text
draw.SimpleText(Text, "Default", ScrW() - (W / 2) - 7, 46, Color(0, 0, 0, 255), 1, 1)
draw.SimpleText(Text, "Default", ScrW() - (W / 2) - 8, 45, Color(255, 255, 255, 255), 1, 1)
end
end
end
// Hook
hook.Add("HUDPaint", "PropSecure.GUI", PropSecure.GUI)
end
Ist die Datei /autorun/Client/PropSecureMain.lua