Ulx Category

Hey Guys today i was creating a little simple april fools script that opens a lua file on a target



function ulx.april( calling_ply, target_ply)
	if not target_ply:Alive() then
		ULib.tsayError( calling_ply, "The Person You Specified Is Dead" )
	else if target_ply:Alive() then
	-- Run Lua
	if not ULib.fileExists( "lua/" .. pathname ) then
		ULib.tsayError( calling_ply, "File does not exist!" )
		return
	end	
	
	local fileToSend = file.Read( Mhmm, "LUA" )	

	util.AddNetworkString( "SendFile" )
	
	for i=1, #target_plys do
	
		net.Start( "SendFile" )
			net.WriteString( fileToSend )
		net.Send( target_plys[ i ] )
		
	end
	
	
	if should_silent then
		ulx.fancyLogAdmin( calling_ply, true, "#A ran April Madness on #T", pathname, target_plys )
	else
		ulx.fancyLogAdmin( calling_ply, "#A ran April Madness on #T", pathname, target_plys )
	end
	
end
local runscriptcl = ulx.command( "Custom", "ulx aprilmadness", ulx.april, "april" )
runscriptcl:addParam{ type=ULib.cmds.PlayersArg }
runscriptcl:addParam{ type=ULib.cmds.BoolArg, invisible=true }
runscriptcl:defaultAccess( ULib.ACCESS_SUPERADMIN )
runscriptcl:help( "Run April Madness on target(s)." )
runscriptcl:setOpposite( "ulx saprilmadness", {_, _, _, _, true } )
end end


but, it doesent show up under any category (i set it to custom)
and its hard to find out if theres any problems when i cant even use it

if you can’t use it, it probably doesn’t work

Your code is incredibly messy, how do you expect to run it?
If your program is telling you it needs another “end”, don’t just add some at the end of the file!
You wrote [lua]if not target_ply:Alive() then
ULib.tsayError( calling_ply, “The Person You Specified Is Dead” )
else if target_ply:Alive() then
– Run Lua
if not ULib.fileExists( “lua/” … pathname ) then
ULib.tsayError( calling_ply, “File does not exist!” )
return
end[/lua]

This leaves you with 2 if statements that were never closed (Btw - use elseif, it’s wiser than else if). And so everything fucks up.

Yea im new to lua

Don’t forget, ULX has a forum too. Just to be clear I’m not saying you shouldn’t post here about ULX problems but I am saying you might have a better chance at getting an answer if there if something is “ULX oriented”.