Skip to content

Commit

Permalink
chore: fix fixer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinFunk committed Oct 26, 2017
1 parent 5537677 commit e8a99d8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lua/ps2/server/pts_fixer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,28 @@ local function setPointsGlobal(ply, cmd, args)
end

local currencyType, amount = args[1], args[2]
if not table.HasValue({"points", "premiumPoints"}, currencyType) then
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 1 (currencyType). Valid: points, premiumPoints. Given: " .. currencyType)

if not currencyType then
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 1 (curencyType). Allowed: points, premiumPoints\n")
print("Usage: ps2_setwallet_all [points|premiumPoints] [amount]")
print(" Sets all wallets points or premiumPoints to the amount specified.")
return
end

if not amount then
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 2 (amount).")
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 2 (amount).\n")
print("Usage: ps2_setwallet_all [points|premiumPoints] [amount]")
print(" Sets all wallets points or premiumPoints to the amount specified.")
return
end

if not table.HasValue({"points", "premiumPoints"}, currencyType) then
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 1 (currencyType). Valid: points, premiumPoints. Given: " .. currencyType .. "\n")
print("Usage: ps2_setwallet_all [points|premiumPoints] [amount]")
print(" Sets all wallets points or premiumPoints to the amount specified.")
return
end

print("[FIXPTS] -> Setting all wallet's " .. currencyType .. " to " .. amount)
Pointshop2.DB.ConnectionPromise:Then(function()
print('[FIXPTS] -> Connected to database')
Expand All @@ -74,8 +82,9 @@ local function updatePoints(ply, cmd, args)
end

local currencyType, amount = args[1], args[2]
if not table.HasValue({"points", "premiumPoints"}, currencyType) then
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 1 (currencyType). Valid: points, premiumPoints. Given: " .. currencyType)
if not currencyType or not table.HasValue({"points", "premiumPoints"}, currencyType) then
currencyType = tostring(currencyType)
MsgC(Color(255, 0, 0), "ERROR: Invalid argument 1 (currencyType). Valid: points, premiumPoints. Given: " .. currencyType .. "\n")
print("Usage: ps2_updatewallet_all [points|premiumPoints] [amount]")
print(" Adds the specified amount of points/premiumPoints to all player's wallets. Negative numbers take points away.")
return
Expand Down

0 comments on commit e8a99d8

Please sign in to comment.