• RunConsoleCommand through lua file
    3 replies, posted
How it goes: On my site a player pays for vip, his steamid will be added to a mysql database after payment to a table called unlcaimed. when they join the server, there is a lua file checking if they have to be added to the vip group. When it is, it removes their ID from the database and runs a command in the server. [code]RunConsoleCommand("ulx", "tempadduserid", "" .. ply:SteamID() .. "", "vip", "2880", "user")[/code] [code]RunConsoleCommand("ulx", "tempadduserid", "STEAMID", "newgroup", "amount of time", "groupafter")[/code] The problem is that the above command isnt working. I've tried running this: [code]RunConsoleCommand("ulx", "slay", "myname")[/code] and it worked fine, but when changing it to this: [code]RunConsoleCommand("ulx", "adduser", "myname", "vip")[/code] It didn't do anything. Though I just noticed this error: [code] [ERROR] RunString:1: bad argument #1 to 'RunConsoleCommand' (string expected, got table) 1. RunConsoleCommand - [C]:-1 2. unknown - RunString:1 3. RunString - [C]:-1 4. call - addons/ulx/lua/ulx/modules/sh/rcon.lua:21 5. __fn - addons/ulib/lua/ulib/shared/commands.lua:943 6. unknown - addons/ulib/lua/ulib/shared/commands.lua:1296 7. Run - lua/includes/modules/concommand.lua:69 8. unknown - addons/ulib/lua/ulib/shared/commands.lua:1310 9. unknown - lua/includes/modules/concommand.lua:69 [/code] the steamid does get removed from the mysql database.
Use better function names so it's easier)
Im not positive about this, but shouldn't this [code]RunConsoleCommand("ulx", "adduser", "myname", "vip")[/code] be [code]RunConsoleCommand("ulx adduser myname vip")[/code] as it is all one command and not four separate ones?
[QUOTE=ZachPL;41976116]Im not positive about this, but shouldn't this [code]RunConsoleCommand("ulx", "adduser", "myname", "vip")[/code] be [code]RunConsoleCommand("ulx adduser myname vip")[/code] as it is all one command and not four separate ones?[/QUOTE] RunConsoleCommand takes a string as the command for the first parameter, and any number of parameters for arguments to the command.
Sorry, you need to Log In to post a reply to this thread.