General > Developers Corner

Help please.

(1/3) > >>

Unknown Gamer:
Hey,
I need some help with my code. Its suppsed to be when someone types !yes into chat. it returns "Get denied. No." in console. Any help with my code would be appreacitated :)


--- Code: ---function ulx.response( PrintMessage )
Player:PrintMessage( HUD_PRINTCONSOLE, "Get denied. No." )
end
end

local response = ulx.response( CATEGORY_NAME, "ulx response", ulx.response, "!yes" )
response:addParam{ type=ULib.cmds.PlayersArg }
response:defaultAccess ( ULib.ACESS.ADMIN )
response:help ( "A test script for creepy" )
--- End code ---

This is my first code from scratch. So I may not get things a be a newb.

JamminR:
If it's not obvious looking over our actual code files, see "NEW STUFF HERE" section of post from some years ago.
How-To/Comparison - ULX SVN vs old ULX release command structure
(Though, technically "new" when that post was written, we've been using the "new" style almost 5 years now)
Oh, and there's a heavily commented file attachment to that post of a previous converted "rocket" command MrPresident wrote.
Comments should be reasonably self explanatory.

Other good posts are the stickies at the top of our developer forum, where I moved your question to.
Want to patch or work on a Ulysses project? Use our codestyle.
ULib Documentation
Resources to get started with Lua

Unknown Gamer:
*BUMP*

Neku:
JamminR just gave you a bunch of resources to help you, yet you bump the thread.
For what?

JamminR:
He posted code change. But, yeah, rather than 'bump', he should have posted a question or statement.
He's not paying attention/learning to read what Gmod errors are telling him.
Gmod would give him 3 errors off the bat.
One about table not expected, one about null variable, one about end of line/function.
1) He's using ULX 'playerSArg...which passes a table of players (even if table only has one player), not a single player .
2) He's not defining the variable for what Player is tied to in the print message.
3) He's also got two "end"s in the function that would only need one at this point.

Navigation

[0] Message Index

[#] Next page

Go to full version