Author Topic: How do i use RunConsoleCommand proparly?  (Read 2318 times)

0 Members and 2 Guests are viewing this topic.

Offline DarkIce

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
How do i use RunConsoleCommand proparly?
« on: February 17, 2017, 10:47:39 AM »
Hello,
i have problems with my small code here:
Code: [Select]

local CATEGORY_NAME = "DarkCMDs"

ulx.moneycount = {}
function updateMoney()
table.Empty(ulx.moneycount)
    table.insert(ulx.moneycount,"10")
    table.insert(ulx.moneycount,"20")
    table.insert(ulx.moneycount,"30")
table.insert(ulx.moneycount,"40")
end
hook.Add( ULib.HOOK_UCLCHANGED, "ULXDonatedMoneyUpdate", updateMoney )
updateMoney()

function ulx.donated(target_ply, moneycount)
if moneycount == "10" then
RunConsoleCommand("ulx", "adduser" target_ply "donator")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "points" "10000000")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "premiumPoints" "350000")
end
if moneycount == "20" then
RunConsoleCommand("ulx", "adduser" target_ply "donator")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "points" "30000000")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "premiumPoints" "1000000")
end
if moneycount == "30" then
RunConsoleCommand("ulx", "adduser" target_ply "donator")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "points" "60000000")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "premiumPoints" "3000000")
end
if moneycount == "40" then
RunConsoleCommand("ulx", "adduser" target_ply "donator")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "points" "100000000")
RunConsoleCommand("ps2_addpoints", target_ply:SteamID "premiumPoints" "6000000")
end
end
local donated = ulx.command(CATEGORY_NAME, "ulx donated", ulx.donated, "!donated", true)
donated:addParam{ type=ULib.cmds.PlayerArg }
force:addParam{ type=ULib.cmds.StringArg, completes=ulx.moneycount, hint="Donated Money" }
donated:defaultAccess( ULib.ACCESS_SUPERADMIN )
donated:help( "Donator add" )

It says:
Code: [Select]
[ERROR] addons/darkaddon/lua/ulx/modules/sh/darkcmds.lua:113: ')' expected near 'target_ply'
  1. unknown - addons/darkaddon/lua/ulx/modules/sh/darkcmds.lua:0

Can you help me with that pls?

Greetings
« Last Edit: February 17, 2017, 10:50:46 AM by DarkIce »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given