Ok, I'm stuck its struggling to identify the variables i.e. "v" as the target player and "credits" as the value. Please help!
local CATEGORY_NAME = "Day-Z Admin"
local gamemode_error = "The current gamemode is not Gmod Day-Z"
------------------------------ Give Credits ------------------------------
function ulx.givecredits( calling_ply, target_plys, credits )
if not GetConVarString("gamemode") == "dayz" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
RunConsoleCommand("dz_giveitem", "item_credits", v, credits )
table.insert( affected_plys, v )
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T credit to #i.", affected_plys, credits )
end
end
local givecredit = ulx.command( CATEGORY_NAME, "ulx givecredits", ulx.givecredits, "!givecredits" )
givecredit:addParam{ type=ULib.cmds.PlayersArg }
givecredit:addParam{ type=ULib.cmds.NumArg, hint="The credit the player should get.", min=1, default=1 }
givecredit:defaultAccess( ULib.ACCESS_ADMIN )
givecredit:help( "Gives credit to a player." )
------------------------------ Give Money ------------------------------
function ulx.givemoney( calling_ply, target_plys, money )
if not GetConVarString("gamemode") == "dayz" then ULib.tsayError( calling_ply, gamemode_error, true ) else
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
RunConsoleCommand("dz_giveitem", "item_money", v, money )
table.insert( affected_plys, v )
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T money to #i.", affected_plys, money )
end
end
local givemoney = ulx.command( CATEGORY_NAME, "ulx givemoney", ulx.givemoney, "!givemoney" )
givemoney:addParam{ type=ULib.cmds.PlayersArg }
givemoney:addParam{ type=ULib.cmds.NumArg, hint="The money the player should get.", min=1, default=1 }
givemoney:defaultAccess( ULib.ACCESS_ADMIN )
givemoney:help( "Gives money to a player." )