Event Menu

Hello, my name’s PIXX.

I have given up on my shitty menu.

Please help



function base_event(player,commandName,args)
	if !file.Exists("event_name.txt","DATA") and !file.Exists("event_starter.txt","DATA") then
	file.Write("event_name.txt",table.concat(args," ").."")
	file.Write("event_starter.txt","Started by: "..player:Name())
	elseif file.Exists("event_name.txt","DATA") and file.Exists("event_starter.txt","DATA") then
	file.Delete("event_name.txt")
	file.Delete("event_starter.txt")
	file.Write("event_name.txt",table.concat(args," ").."")
	file.Write("event_starter.txt","Started by: "..player:Name())
	end
	MsgAll(player:Name().."started an event:"..table.concat(args," ").."
")
end

concommand.Add("event_suggest",base_event)

concommand.Add("current_event")
if file.Exists("event_name.txt","DATA") and file.Exists("event_starter.txt","DATA") then
local eventname = file.Read("event_name.txt","DATA")
local eventstarter = file.Read("event_starter.txt","DATA")
print("Current Event is: "..eventname..". And it was started by: "..eventstarter)
end

function chatCommand( ply, text, public, args )
    if (string.sub(text, 1, 14) == "!event_suggest") then
         LocalPlayer():ConCommand("event_suggest "..table.concat(args," "))
         return(false)
    end
end

hook.Add("OnPlayerChat","MakeEvent",function(ply, str, bteam)
str = string.lower(str)
	if(str == "!emenu") then
		if (IsValid(pl)) then
			local version = "1.2"
			local frame= vgui.Create( "DFrame" )
			frame:SetPos( ScrW()/2 - 300, ScrH()/2 - 150 )
			frame:SetSize( 600, 300 )
			frame:ShowCloseButton( true )
			frame:MakePopup()
			frame:SetTitle("Event Menu")
			txt_entry = vgui.Create("DTextEntry", frame)
			txt_entry:SetText("Enter event name")
			txt_entry:SetSize(120, 20)
			txt_entry:SetPos(10,30)
			txt_entry2 = vgui.Create("DTextEntry", frame)
			txt_entry2:SetText("Enter what the event is about here!")
			txt_entry2:SetSize(200, 50)
			txt_entry2:SetPos(130,30)
			txt_entry3 = vgui.Create("DTextEntry", frame)
			txt_entry3:SetText("Enter where they are suppose to be when the event starts!")
			txt_entry3:SetSize(200, 50)
			txt_entry3:SetPos(230,30)
			local versiontext = vgui.Create( "RichText", frame )
			versiontext:SetSize(200,20)
			versiontext:SetPos(100,100)
			versiontext:SetText("Version: "..version)
			local infotext = vgui.Create( "RichText", frame )
			infotext:SetSize(200,20)
			infotext:SetPos(450,30)
			infotext:SetText("Player Info:")
			local Avatar = vgui.Create( "AvatarImage", frame )
			Avatar:SetSize( 64, 64 )
			Avatar:SetPos( 450, 50 )
			Avatar:SetPlayer( LocalPlayer(), 64 )
			local nametext = vgui.Create( "RichText", frame )
			nametext:SetSize(200,20)
			nametext:SetPos(450,114)
			nametext:SetText("Name: "..LocalPlayer():Nick())
			local hptext = vgui.Create( "RichText", frame )
			hptext:SetSize(200,20)
			hptext:SetPos(450,134)
			hptext:SetText("HP: "..LocalPlayer():Health())
			local armortext = vgui.Create( "RichText", frame )
			armortext:SetSize(200,20)
			armortext:SetPos(450,154)
			armortext:SetText("Armor: "..LocalPlayer():Armor())
			local ostext = vgui.Create( "RichText", frame )
			ostext:SetSize(200,20)
			ostext:SetPos(450,174)
			if system.IsWindows() == true then
			ostext:SetText("OS: ".."Windows")
			elseif system.IsOSX() == true then
			ostext:SetText("OS: ".."Mac OS X")
			elseif system.IsLinux() == true then
			ostext:SetText("OS: ".."Linux")
			else
			ostext:SetText("OS: ".."Unknown")
			end
			local countrytext = vgui.Create( "RichText", frame )
			countrytext:SetSize(200,20)
			countrytext:SetPos(450,194)
			countrytext:SetText("Country: "..system.GetCountry())
			but_entry = vgui.Create("DButton", frame)
			but_entry:SetSize(120, 20)
			but_entry:SetPos(10,50)
			but_entry:SetText("Start Event")
			but_entry.DoClick = function()
			chat.AddText(LocalPlayer():GetName().." started "..txt_entry:GetValue()..". Description reads: "..txt_entry2:GetValue()..". You need to be at: "..txt_entry3:GetValue())
			end
		end
    end
    return true
end)


I have tried
Making a timer to check if you are doing: !emenu
Networking

If you are gonna help me with something… explain please for the love of god

  • PIXX, a bit tired of the menu not working


if (IsValid(pl)) then


You never set pl. However, you DID set ply.

[editline]17th August 2016[/editline]

By the way, here:



concommand.Add("current_event")


You never set the function to get run when the command is called

Also, this:



if system.IsWindows() == true then


Is equivalent to this:



if system.IsWindows() then


Other than that, this menu looks like it would work.

Never give up, never surrender ~ DJ Khaled

I am… stupid… tired and thankful.

[editline]17th August 2016[/editline]

Update: Still doesn’t work.

What doesn’t work about it? Your console commands don’t work? Chat commands? It errors?

Well just looking at the syntax highlighting for 2 seconds you will find out it literslly screams "U FORGOT TO FUCKING CLOSE ME