General > Developers Corner

Command Confusion

<< < (3/6) > >>

EMB:
...
I'm not a dumbass, what is wrong with the code?

imitate:addParam{ type=ULib.cmds.StringArg } -- Second param is the string to use

Megiddo:
It's not that part of your code that's the problem, it's when you're calling TranslateCommand.

EMB:

--- Code: ----- To imitate a player speaking.
-- Made by EMB

-- The actual function
function UImitate( target_plys, stuff_say )
   for i=1, #target_plys do -- For every player
        target_plys[ i ]:concommand( "say " .. stuff_say ) -- Make the person say it
   end
end

-- Add the command
local imitate = ULib.cmds.TranslateCommand:instantiate( "ulx imitate", UImitate, "!im", true )
imitate:addParam{ type=ULib.cmds.PlayersArg } -- First param is the target player(s)
imitate:addParam{ type=ULib.cmds.StringArg } -- Second param is the string to use
imitate:defaultAccess( ULib.ACCESS_OWNER ) -- Who has access by default.

--- End code ---

What is wrong?

Megiddo:
You haven't defined the function, you need to have a function to call back.

EMB:
Wut?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version