View Single Post
Old 02-08-2007, 10:48 AM   #2
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Some more examples:

autoexec.lua:
Code:
if cg.Gametype() == cg.GT_CTF or cg.Gametype() == cg.GT_CTY then
  cg.LuaExec("ctf.lua")
elseif cg.Gametype() == cg.GT_SIEGE then
  cg.LuaExec("siege.lua")
else
  cg.LueExec("defaults.lua")
end

if cg.IsJAPlus() then -- If Server is JA+
  serverinfo = cg.GetConfigString(cg.CS_SERVERINFO) -- Put CS_SERVERINFO data in 'serverinfo'
  version = cg.Info_ValueForKey(serverinfo, "V") - Find "V" key and put it's data in version
  cg.Command(string.format("say \"Detected JA+ Server! Mod Version: %s\"\n", ver))
end
ctf.lua:
Code:
cg.Cvar_Set("cg_drawRadar", "0")
cg.LoadHud("ctfhud")
siege.lua:
Code:
cg.Cvar_Set("cg_drawRadar", "1")
cg.LoadHud("siegehud")
defaults.lua:
Code:
cg.Cvar_Set("cg_drawRadar", "0")
cg.LoadHud("ensiform")
Code:
bind c "lua_exec location.lua"
location.lua:
Code:
function SendLocation()
  cg.Command(string.format("say_team \"My Location is: %s^5!\"\n", cg.PlayerData(cg.LOCATION)
end

SendLocation()
spawn.lua:
Code:
function SayClass()
  if cg.Gametype() == cg.GT_SIEGE and cg.SiegeValid() == true then
    if cg.PlayerData(cg.TEAM) ~= cg.TEAM_SPECTATOR and cg.PlayerData(cg.SPECSTATE) == false then
      cg.Command(string.format("say_team \"Spawning as: %s...\"\n", cg.PlayerData(cg.SIEGECLASS)))
    end
  end
end

SayClass()


iojamp project lead / coder

Last edited by ensiform; 02-08-2007 at 12:00 PM.
ensiform is offline   you may: quote & reply,