Skip to content

Instantly share code, notes, and snippets.

View leegao's full-sized avatar

Lee Gao leegao

  • Google
  • Jersey City, NJ
View GitHub Profile
function switch(t)
t.case = function (self,x, p, com)
local f=self[x] or self.default
if f then
if type(f)=="function" then
f(p, x, com)
else
error("case "..tostring(x).." not a function")
end
end
description = {}
description.credits =
[[
Author: Lee Gao
License: Creative Common
Title: CS2D Enhanced Mod System
]]
--Example Port of Stiil's LDM into AMX2D
--------------------------------------------------
-- Laser Deathmatch Script by STIIL --
-- 31.03.2009 - www.pavi.890m.com --
--------------------------------------------------
init_mod("ldm")
--server.lua
local dir = "sys/lua/amx2d"
dofile(dir.."main.lua")
main(dir)
if load(mod_dir.."mod_quakeMod") then
print("mod_quakeMod.lua successfully loaded")
end
init_mod("echo")
echo.var("prefix","Server echoed: ", "svar")
function act_echo(p, typ, cmd)
msg(p, echo.prefix..cmd)
end
return echo.name
init_mod("sample_move")
function hook_move_sample(p, x, y)
parse(string.format("hudtxt2 %s 1 %sPlayer '%s' is at (%s, %s) 100 100 1", p, Color(255, 100, 0), player(p, "name"), x, y))
end
toMod("sample_move")
if flacko==nil then flacko={} end
flacko.admins={}
function flacko.admins.split(t,b)
return toTable()
end
function toTable(t, b) --By leegao--
local cmd = {}
from waveapi import events, robot
def _register(self, event):
def _wrapper(fn):
self.RegisterHandler(events.__getattribute__(event), fn)
return _wrapper
robot.Robot.register = _register
"""
#Sample usage
--Initialize
init_mod("sv")
sv.var("prefix","Server echoed: ", "svar")
sv.var("broadcasttimeout", 60, "svar")
sv.var("debug", 0, "svar")
sv.var("buy", 1, "svar")
sv.var("drop", 1, "svar")
sv.var("collect", 1, "svar")
sv.broadcasttime = initArray(32)