General > Developers Corner
Trying to make a command
(TG) PotLuck:
My ULib/ULX versions (run "ulx version" in console): Won't work? I have the latest...
ULib v..
ULX v..
Game mode(s) I am having this problem on: Deathrun
Lua errors shown in console, if any:
--- Code: ---<insert errors here>
--- End code ---
I know this may sound stupid but there have been tons of request on my server for a command that gives someone cookies. I have made commands before but I don't know how to do this one. I don't need it to store an amount of cookies within the server files but just print into chat something like, "#A gave #T "number" cookies!" I just need help making it please.
Bytewave:
So... there's no other use than to just print a chat message?
If so, that's just as simple as a PlayerArg, a (rounded) NumberArg, and a fancyLogAdmin with the #i token. While it uses a PlayersArg, ulx slap should be easy to modify (remove function body save for the fancyLogAdmin call, rename target_plys to target_ply for consistency, change PlayersArg to PlayerArg, and edit the message string, keeping the tokens in-tact).
(TG) PotLuck:
--- Quote from: Bytewave on July 08, 2016, 03:08:32 PM ---So... there's no other use than to just print a chat message?
If so, that's just as simple as a PlayerArg, a (rounded) NumberArg, and a fancyLogAdmin with the #i token. While it uses a PlayersArg, ulx slap should be easy to modify (remove function body save for the fancyLogAdmin call, rename target_plys to target_ply for consistency, change PlayersArg to PlayerArg, and edit the message string, keeping the tokens in-tact).
--- End quote ---
Any way you can help me with the code itself? I have no idea how I would structure this....
roastchicken:
Look at the code for the default commands. You should be able to copy paste the code and change it to match your needs.
The code for commands is located in garrysmod/addons/ulx/lua/ulx/modules/sh/. You can also view the commands' code online.
(TG) PotLuck:
--- Quote from: roastchicken on July 09, 2016, 12:57:29 AM ---Look at the code for the default commands. You should be able to copy paste the code and change it to match your needs.
The code for commands is located in garrysmod/addons/ulx/lua/ulx/modules/sh/. You can also view the commands online.
--- End quote ---
Again, I know how to make commands, it is just this one thing I am getting hung up on. I have a few commands already, I just don't know how to do the number thing. Like the gold-star command on your old server roast.
Navigation
[0] Message Index
[#] Next page
Go to full version