ULX

Author Topic: ULX Custom command to set a var  (Read 2686 times)

0 Members and 1 Guest are viewing this topic.

Offline Best Wukong NA

  • Newbie
  • *
  • Posts: 3
  • Karma: 2
ULX Custom command to set a var
« on: November 12, 2015, 10:19:45 AM »
I'm not sure if this should be posted in developers corner or general chat but I think this is the right place.
I'm trying to make a custom command that sets the rank of a player. The rank NWInt is ("playerLvl")
How do I make a number input that sets the NWInt("playerLvl") to the number thats chosen?
I've already looked at the ulx slap as an example but I couldn't find it.

Code: [Select]
local CATEGORY_NAME = "BFA"

function ulx.rank ( calling_ply, target_ply, level )
local affected_plys = {}
for i=1, #target_plys do
   local v = target_plys[ i ]
   v:SetNWInt("playerLvl",level)
   table.insert( affected_plys, v )

   ulx.fancyLogAdmin(calling_ply, true, "#A has changed the rank of #T",target_ply)
   end
end

local rank = ulx.command (CATEGORY_NAME,"ulx rank",ulx.rank,"!rank",true)
rank:addParam{type=ULib.cmds.PlayerArg}
rank:defaultAccess(ULib.ACCESS_ADMIN)
rank:help("Sets the rank of a player")
« Last Edit: November 12, 2015, 10:32:33 AM by Best Wukong NA »

An Error Has Occurred!

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