General > Developers Corner
Trying to make a command
roastchicken:
Try to get as far as you can on the command, and come ask for help if you get stuck.
If you've already gotten stuck, it would be helpful to see your code.
(TG) PotLuck:
I don't know how to add in a ply or something of the sort for numbers. like how you have calling play and target ply, what do you use for numbers?
roastchicken:
As Bytewave suggested, take a look at the slap command' code. It has a number argument.
(TG) PotLuck:
I'm doing that right now
(TG) PotLuck:
--- Code: ---CATEGORY_NAME = "Custom Commands by Pot"
function ulx.cookie( calling_ply, target_ply, dmg )
local affected_plys = {}
for i=1, #target_ply do
local v = target_ply[ i ]
if v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
else
ULib.cookie( v, dmg )
table.insert( affected_plys, v )
end
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i cookies!", affected_plys, dmg )
end
local cookie = ulx.command( CATEGORY_NAME, "ulx cookie", ulx.cookie, "!cookie" )
cookie:addParam{ type=ULib.cmds.PlayerArg }
cookie:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="damage", ULib.cmds.optional, ULib.cmds.round }
cookie:defaultAccess( ULib.ACCESS_ADMIN )
cookie:help( "Gives someone cookies!" )
--- End code ---
That is what I have, but it still wont work. I tried to do what Bytewave said but it was confusing for me. I am still a little new to working with ULX
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version