summaryrefslogtreecommitdiff
path: root/gamemode/shared/developer_cheats.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-04-30 20:15:02 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-04-30 20:15:02 -0400
commitadcec79b09baa5b6804795077caae8ad7e6c0394 (patch)
tree005db3dde02b7082fa8c6611d2911da9c1b6e88b /gamemode/shared/developer_cheats.lua
parent603b64b1a93b36f04d25018ec3f53b16dcd84019 (diff)
downloadgmstranded-adcec79b09baa5b6804795077caae8ad7e6c0394.tar.gz
gmstranded-adcec79b09baa5b6804795077caae8ad7e6c0394.tar.bz2
gmstranded-adcec79b09baa5b6804795077caae8ad7e6c0394.zip
Added mineing resources
Diffstat (limited to 'gamemode/shared/developer_cheats.lua')
-rw-r--r--gamemode/shared/developer_cheats.lua56
1 files changed, 56 insertions, 0 deletions
diff --git a/gamemode/shared/developer_cheats.lua b/gamemode/shared/developer_cheats.lua
new file mode 100644
index 0000000..e8c4fbb
--- /dev/null
+++ b/gamemode/shared/developer_cheats.lua
@@ -0,0 +1,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)