General > Developers Corner
I need someone to troubleshoot
Government Official:
I am Learning LUA and How to Make Custom ULX Commands and stuff
and I tried to make my own !fmotd command but for some reason it wont work There is no errors its just nothing happens
--- Code: ---function ulx.fmotd( calling_ply, target_plys )
do target_plys:ConCommand( "ulx motd" )
ulx.fancyLogAdmin( calling_ply, true, "#A Forced #T to look at the Motd!", target_ply )
end
end
local fmotd = ulx.command( CATEGORY_NAME, "fmotd", ulx.respawn, "!fmotd", false )
fmotd:addParam{ type=ULib.cmds.PlayerArg }
fmotd:defaultAccess( ULib.ACCESS_ADMIN )
fmotd:help( "Forces a Player to look at the Motd." )
--- End code ---
If you know the fix please help me
EDIT - JamminR - edited code tags from <> to []
JamminR:
Trust me, you're getting errors.
Likely at server startup.
'do' is not a valid command by itself.
You have an extra "end", and from the looks of it, you've modified a while/do statement that "end" used to finish.
Unless there's more code you've not shown us, "CATEGORY_NAME" isn't defined.
You're also calling one of our commands (ulx.respawn) once you get the command working. You'll want to call ulx.fmotd.
Once you get those sported out, you may want to edit your variable names for simplicity.
In ULX, we use 'target_plys' as a table, plural, more than one, of players.
Though you've used the proper setup in the command object to only send a single player, (ULib.cmds.PlayerArg), it would be easier on you if you don't use a variable that looks plural unless you plan to change it later to accept plural.
Government Official:
CATEGORY_NAME is Defined
I forgot to change it from ulx.respawn to ulx.fmotd when I Copied and pasted it
I tried just doing
target_plys:ConCommand( "ulx motd")
ulx.fancyLogAdmin( calling_ply, true, "#A Forced #T to look at the Motd!", target_ply )
But Nothing happened so I tried puting a Do there
When I was first testing this I was testing it on TTT at first and it was saying something about target_plys but i will change it to target_ply
I will check for a error closely once I restart it
Is the first or second error an extra?
roastchicken:
I'm not sure about others, but I don't understand exactly what you're having trouble with right now. I suggest you post the full error(s) so we can help you better.
Government Official:
I just checked and there is no errors showing up at Start
Ok well I got rid of Do and the extra end and changed it too target_ply
The Motd wont show up but the Log works fine
Navigation
[0] Message Index
[#] Next page
Go to full version