diff options
| author | Scott <scotth0828@gmail.com> | 2016-04-30 20:34:42 -0400 |
|---|---|---|
| committer | Scott <scotth0828@gmail.com> | 2016-04-30 20:34:42 -0400 |
| commit | bdf6cacc1fe7af364b93604253f3229d842d6170 (patch) | |
| tree | 21015081b4d66d45390ba625c09fb84d143f63db /gamemode/shared | |
| parent | e8fc8b5bf824ed3283dede946e66f5fd843d54ff (diff) | |
| parent | c6b56a911622f9a52fd92293074192d1f13d3e96 (diff) | |
| download | gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.tar.gz gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.tar.bz2 gmstranded-bdf6cacc1fe7af364b93604253f3229d842d6170.zip | |
Merge branch 'master' of ssh://cogarr.net:43/home/git/gmsurvival
Diffstat (limited to 'gamemode/shared')
| -rw-r--r-- | gamemode/shared/developer_cheats.lua | 56 |
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) |
