General > Developers Corner
LUA error
Tomzen:
Source:
--- Code: ---local CATEGORY_NAME = "Custom"
function ulx.impersonate( calling_ply, msg, target_plys )
target_plys:ConCommand("say ", msg)
ulx.fancyLogAdmin( calling_ply, true, "#A impersonated #T", target_plys )
end
local impersonate = ulx.command( CATEGORY_NAME, "ulx impersonate", ulx.impersonate, "!imp" )
impersonate:addParam{ type=ULib.cmds.PlayersArg }
impersonate:addParam{ type=ULib.cmds.StringArg, hint="msg" }
impersonate:addParam{ type=ULib.cmds.BoolArg, invisible=true }
impersonate:defaultAccess( ULib.ACCESS_SUPERADMIN )
impersonate:help( "Impersonates a player." )
--- End code ---
Error:
--- Code: ---
[ERROR] addons/ulx/lua/ulx/modules/sh/custom.lua:3: bad key to string index (number expected, got string)
--- End code ---
Aaron113:
For one, you have your parameters backwards. They must be in the order you added them. Try fixing that and see where the script stands. I see possibly a few other things that need tweaking.
XxLMM13xX:
Interesting command! What's you plans for this?
JamminR:
Pretty obvious.
Kind of like gimp, but, you control what the target says real time rather than from a table of pre-configured gimp sayings.
Fun idea.
Though I see this as the opportunity to give someone the ability to do this that you might not trust with "ulx cexec" access, it can also be done using cexec.
ulx cexec <target> say "string"
Cexec is pretty powerful though, I can imagine not trusting as many people with it as you might this impersonate command.
XxLMM13xX:
well what would this be used for? why would you need to talk in someone else?
Navigation
[0] Message Index
[#] Next page
Go to full version