Malfunctioning Evolve plugins

This is used for general discussion that is not necessarily server-related.
Post Reply
ThatBum
A regular
A regular
Posts: 35
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri May 20, 2011 3:01 pm

Malfunctioning Evolve plugins

Post by ThatBum »

Hello hello and thrice hello. I am having problems with a few Evolve plugins.

Firstly, the MOTD plugin of Divran's is not functional. It spits this on player join:

Code: Select all

[ev_plugins\sh_motd2.lua:88] attempt to index field 'StartPanel' (a nil value)
Timer Error: [@ev_plugins\sh_motd2.lua:79] bad argument #1 to 'SetHTML' (string expected, got no value)
This is sh_motd2.lua:

Code: Select all

/*-------------------------------------------------------------------------------------------------------------------------
	Message of the Day
-------------------------------------------------------------------------------------------------------------------------*/

local PLUGIN = {}
PLUGIN.Title = "MOTD"
PLUGIN.Description = "Message of the Day."
PLUGIN.Author = "Divran"
PLUGIN.ChatCommand = "motd"
PLUGIN.Usage = nil
PLUGIN.Privileges = nil

function PLUGIN:Call( ply, args )
	self:OpenMotd( ply )
end

function PLUGIN:PlayerInitialSpawn( ply )
	timer.Simple( 1, function() ply:ConCommand("evolve_startmotd") end)
end

function PLUGIN:OpenMotd( ply )
	if (SERVER) then
		ply:ConCommand("evolve_motd")
	end
end

if (SERVER) then 
	if (file.Exists("evolvemotd.txt")) then
		resource.AddFile("data/evolvemotd.txt")
	end
end


if (CLIENT) then
	function PLUGIN:CreateMenu()
		self.StartPanel = vgui.Create( "DFrame" )
		local w,h = 150,50
		self.StartPanel:Center()
		self.StartPanel:SetSize( w,h )
		self.StartPanel:SetTitle( "Welcome!" )
		self.StartPanel:SetVisible( false )
		self.StartPanel:SetDraggable( true )
		self.StartPanel:ShowCloseButton( false )
		self.StartPanel:SetDeleteOnClose( false )
		self.StartPanel:SetScreenLock( true )
		self.StartPanel:MakePopup()
		
		self.OpenButton = vgui.Create("DButton",self.StartPanel)
		self.OpenButton:SetSize( 150/2-4, 20 )
		self.OpenButton:SetPos( 2, 25 )
		self.OpenButton:SetText( "Open MOTD" )
		self.OpenButton.DoClick = function() 
			PLUGIN.MotdPanel:SetVisible( true )
			PLUGIN.StartPanel:SetVisible( false ) 
		end
		
		self.CloseButton = vgui.Create("DButton",self.StartPanel)
		self.CloseButton:SetSize( 150/2-6, 20 )
		self.CloseButton:SetPos( 150/2+4, 25 )
		self.CloseButton:SetText( "Close" )
		self.CloseButton.DoClick = function() 
			PLUGIN.StartPanel:SetVisible( false ) 
		end
		
		self.MotdPanel = vgui.Create("DFrame")
		local w,h = ScrW() - 200,ScrH() - 200
		self.MotdPanel:SetPos( 100,100 )
		self.MotdPanel:SetSize( w,h )
		self.MotdPanel:SetTitle( "MOTD" )
		self.MotdPanel:SetVisible( false )
		self.MotdPanel:SetDraggable( false )
		self.MotdPanel:ShowCloseButton( true )
		self.MotdPanel:SetDeleteOnClose( false )
		self.MotdPanel:SetScreenLock( true )
		self.MotdPanel:MakePopup()
		
		self.MotdBox = vgui.Create("HTML",self.MotdPanel)
		self.MotdBox:StretchToParent( 4,25,4,4 )
		self.MotdBox:SetHTML( file.Read( "evolvemotd.txt") )
	end
	timer.Simple( 0.1, function() PLUGIN:CreateMenu() end)
	
	concommand.Add("evolve_motd",function(ply,cmd,args)
		PLUGIN.MotdPanel:SetVisible( true )
	end)
	
	concommand.Add("evolve_startmotd",function(ply,cmd,args)
		PLUGIN.StartPanel:SetVisible( true )
	end)
	
end

evolve:RegisterPlugin( PLUGIN )
I can run !motd in chat, and the MOTD window comes up, but it is blank. I do have a evolvemotd.txt in /data, it is this:

Code: Select all

<html>
<body bgcolor=#000000>
<div style="text-align: center;">
<div style="width: 80%; margin: 0px auto; border: 10px solid #000000; background-color: #ededed; padding: 10px; font-size: 12px; 

font-family: Tahoma; margin-top: 30px; color: #ff0000; text-align: left;">
<div style="font-size: 30px; font-family: impact; width: 100%; margin-bottom: 5px;">TurboNerd Team SpaceBuild 3</div>
<br>
This server uses SpaceBuild 3 and accompanying mods. There is a list of SVN links here:
<a href="http://sbep.wikia.com/wiki/Getting_Started">
Getting started with SpaceBuild</a>. Please use SVN, and avoid garrysmod.org like the plauge, unless it is for maps or defunct tools.<br>
<h2>Rules</h2>
1. Parent your ships. It is good for you AND the server.<br>
2. You can have space battles only if both parties agree to fight.<br>
3. Do not fly/push gyropods into the water. There is a bug that if gyros go under world, it crashes the server.<br>
4. Please be courteous and help other users when you can. In other words, don't be an asshat.<br>

<h2>Hosting</h2>

The hosting is provided by <a href="http://nfoservers.com">
Nuclear Fallout Servers</a>. They are win. If you are going to make a server and want it to win too, get in contact with me in Steam so I can be your refferer, and this server can win even more with referrer bonuses like more acceleration and higher CPU priority.

<h2>Admins</h2>

ThatBum - Owner and benevolent dick-tater<br>
TR the Only One - Admin<br>
BluntMan420 - Admin<br>
<br>
Forums are <a href="http://forum.turbonerdteam.site.nfoservers.com/">
here</a>.
<br>
<div style="width: 100%; text-align: center; margin: 10px; font-weight: bold;">- ThatBum</div>
</div>
</div>

</body>
</html>
Second, the !commands command is not working, I get this when I run it.

Code: Select all

Plugin 'Chatcommands' failed with error:
[lua\includes\extensions\table.lua:401] attempt to compare string with table
This is sh_commands.lua:

Code: Select all

/*-------------------------------------------------------------------------------------------------------------------------
	Display all chat commands
-------------------------------------------------------------------------------------------------------------------------*/

local PLUGIN = {}
PLUGIN.Title = "Chatcommands"
PLUGIN.Description = "Display all available chat commands."
PLUGIN.Author = "Overv"
PLUGIN.ChatCommand = "commands"

function PLUGIN:Call( ply, args )
	local commands = table.Copy( evolve.plugins )
	table.SortByMember( commands, "ChatCommand", function( a, b ) return a > b end )
	
	if ( ply:IsValid() ) then
		umsg.Start( "EV_CommandStart", ply ) umsg.End()
		
		for _, plug in ipairs( commands ) do
			if ( plug.ChatCommand ) then
				umsg.Start( "EV_Command", ply )
					umsg.String( plug.ChatCommand )
					umsg.String( tostring( plug.Usage ) )
					umsg.String( plug.Description )
				umsg.End()
			end
		end
		umsg.Start( "EV_CommandEnd", ply ) umsg.End()
		
		evolve:Notify( ply, evolve.colors.white, "All chat commands have been printed to your console." )
	else
		for _, plugin in ipairs( commands ) do
			if ( plugin.ChatCommand ) then
				if ( plugin.Usage ) then
					print( "!" .. plugin.ChatCommand .. " " .. plugin.Usage .. " - " .. plugin.Description )
				else
					print( "!" .. plugin.ChatCommand .. " - " .. plugin.Description )
				end
			end
		end
	end
end

usermessage.Hook( "EV_CommandStart", function( um )
	print( "\n============ Available chat commands for Evolve ============\n" )
end )

usermessage.Hook( "EV_CommandEnd", function( um )
	print( "" )
end )

usermessage.Hook( "EV_Command", function( um )
	local com = um:ReadString()
	local usage = um:ReadString()
	local desc = um:ReadString()
	
	if ( usage != "nil" ) then
		print( "!" .. com .. " " .. usage .. " - " .. desc )
	else
		print( "!" .. com .. " - " .. desc )
	end
end )

evolve:RegisterPlugin( PLUGIN )
There is a Google Code issue on this: Issue 334 - evolvemod - !commands command not working - An advanced admin mod for Garry's Mod. - Google Project Hosting

I know nothing about Lua. I would really like some help, I just finished setting up my server and these are the only things not working right. Presumably these worked at one time, but Lua changed or something and whatever it used to do is now invalid. Thanks in advance.
User avatar
Edge100x
Founder
Founder
Posts: 12962
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Malfunctioning Evolve plugins

Post by Edge100x »

I have no experience with LUA scripting on Garrysmod myself, so hopefully someone else can chime in. Have you also asked on Garrysmod-focused forums (the author might even have one)? They will have a bit more traffic about this type of problem.
ThatBum
A regular
A regular
Posts: 35
Joined: Fri May 20, 2011 3:01 pm

Re: Malfunctioning Evolve plugins

Post by ThatBum »

I asked on the Wiremod forums. No response yet. The author of the MOTD one is a lead dev of Wire, so he may pick up on it.
Post Reply