summaryrefslogtreecommitdiff
path: root/gamemode/shared/developer_cheats.lua
blob: e8c4fbb9d4cf702f9a18c464a645c2be09c0775d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--This file contains things to help developers debug while working on the code. All this stuff relies on the Developers table in configre_me.lua

local pmeta = FindMetaTable( "Player" )

function pmeta:IsDeveloper()
  for k,v in pairs(GMS.Developers) do
    if(self:SteamID() == v) then
      return true
    end
  end
  return false
end

-----------------Print inventory---------------------
local printServerResources = function(ply,cmd,args)
  if(CLIENT or (!ply:IsDeveloper())) then return end
  PrintTable(ply.Resources)
end

local printServerResourcesAuto = function(cmd,args) end

concommand.Add("gms_sv_printSvRes",printServerResources,printServerResourcesAuto,"Prints the server representation of your resources")

local printClientResources = function(ply,cmd,args)
  if(SERVER or (!ply:IsDeveloper())) then return end
  PrintTable(Resources)
end

local printClientResourcesAuto = function(cmd,args) end

concommand.Add("gms_sv_printClRes",printClientResources,printClientResourcesAuto,"Prints the client representation of your resources")

------------------Give weapons----------------------
local giveWeapon = function(ply,cmd,args)
  if(!ply:IsDeveloper()) then return end
  if(weapons.Get(args[1]) == nil) then
    print("Could not find weapon:" .. args[1])
    return
  end
  ply:Give(args[1])
end

local giveWeaponAuto = function(cmd,args)
  local possibles = {}
  local needle = string.Trim(args)
  print("\"" .. needle .. "\"")
  for k,v in pairs(weapons.GetList()) do
    local fplace = string.find(v.ClassName,needle)
    if(fplace != nil) then
      table.insert(possibles,cmd .. " " .. v.ClassName)
    end
  end
  return possibles
end

concommand.Add("gms_sv_givewep",giveWeapon,giveWeaponAuto)