Script sharing


(Micha) #1

I thought of to give some usefull scripts to everyone since I stopped playing ET.
HideNseek pack and my infected mod will come soon.

covertinvincible.lua

--[[
This tool makes covertops invincible on death (He can't get gibbed).
Can be modified to all classes. Just remove the "if checklass(j) == 4 then" and the "end" on line 31

Made by Micha!
--]]

Modname = "covertinvincible"
Version = 0.1

samplerate = 100
et.CS_PLAYERS = 689

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print(""..Modname.." Version: "..Version.." Loaded
")
	et.RegisterModname(Modname .. " " .. Version)
	maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
end

function et_RunFrame( levelTime )
 if math.mod(levelTime, samplerate) ~= 0 then return end
	for j = 0, (maxclients - 1) do
		if checkclass(j) == 4 then
			local hp = tonumber(et.gentity_get(j,"health"))
			local body = tonumber(et.gentity_get(j, "r.contents"))
			if body == 67108864 then --if hp <= 0 then --could work too
				et.gentity_set(j, "ps.powerups", 1, levelTime + 9999999 ) --etpub ps.powerups 1 = spawn shield
			elseif body == 33554432 and hp >= 76 then
				et.gentity_set(j, "ps.powerups", 1, 0 )
			end
		end
	end
end
 
--0=Soldier, 1=Medic, 2=Engineer, 3=FieldOps, 4=CovertOps
function checkclass(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
	return tonumber(et.Info_ValueForKey(cs, "c"))
end

--BOOM

rulesetpub.lua

-- Major Zeman's Rules printer
-- version 0.1 (20.7.2007)

-- changelog by Micha!
--
-- v0.2
-- modname
-- server message
-- v0.23
-- made it work on etpub

--
-- The printer can handle both unix and windows line endings (and mac, too)
-- in the input file, however as a price for this, it ignores any empty lines
-- in the input file. Therefore if you desire to print an empty line inside the
-- rules text, use a line with one space (or more of course) instead.
--

------------------------------------------ name ----------------------------------------------

Modname = "Rules"
Version = "0.23"
Text = "^wType ^1!rules ^wto see ^7Server rules"

function et_InitGame(levelTime,randomSeed,restart)
   et.G_Print("[Rules] Version: "..Version.." Loaded
")
   et.RegisterModname(Modname .. " " .. Version)
   et.trap_SendServerCommand(-1, "chat \""..Text.." \"" )
end

function et_ClientConnect( cno, firstTime, isBot )
	if firstTime == 1 then
		et.trap_SendServerCommand(cno, "chat \""..Text.." \"" )
	end
end



------------------------------------------ settings ----------------------------------------------

-- rules filename
RULES_FILENAME = "rules.txt"



----------------------------------------- functions ---------------------------------------------


-- print message to either client's console or (if clientID == nil) to server console
function printmsg(message, clientID)
    if not message then
        return
    end

    -- replace "s in message with 's
    local dummy
    message, dummy = string.gsub(message, "\"", "'")

    if clientID then
        et.trap_SendServerCommand(clientID, "print \"".. message .."^7
\"")
    else
        if lastcallerID then
            et.trap_SendServerCommand(lastcallerID, "print \"".. message .."^7
\"")
        else
            et.G_Print(message .."^7
")
        end
    end
end


-- reads file and returns string array of rows (indexed from 1) and number of rows
function readFile(filename)
    local fd, len
    local rows = {}

    fd, len = et.trap_FS_FOpenFile(filename, et.FS_READ)

    if len == -1 then
        return rows, 0
    else
        --read it all
        local filestr = et.trap_FS_Read(fd, len)

        local rowcount = 0
        for line in string.gfind(filestr, "[^
]+") do
            rowcount = rowcount + 1
            rows[rowcount] = line
        end

            et.trap_FS_FCloseFile(fd)
            return rows, rowcount
      end
end



---------------------------------- client command functions ------------------------------


-- print rules to client
function printrules(clientID)
local playername = et.gentity_get(clientID, "pers.netname")
et.trap_SendServerCommand( clientID, "chat \"^1Console^7: ^2Open the console, ^7"..playername.." \"" )
    rows, numrows = readFile(RULES_FILENAME)

    printmsg("", clientID)

    for i = 1, numrows do
            printmsg(rows[i], clientID)
    end

    printmsg("", clientID)
end



--------------------------------------- callbacks ----------------------------------------

rules_cmd = "!rules"

function et_ClientCommand( clientNum, command )
    -- lowercase
	if et.trap_Argv(0) == "say" or et.trap_Argv(0) == "say_team" or et.trap_Argv(0) == "say_buddy" then
       if string.find(et.trap_Argv(1), "^" .. rules_cmd .. "") then
			printrules(clientNum)
			return 1
		end
    end

    return 0
end

stenwar.lua

Modname = "stenwar"
Version = "1.0"
Author  = "Micha!"
Description = "^7Stenwar"
Homepage = "www.gs2175.fastdl.de"

--[[
			Based on noweapon.lua
-------------------------------------------------------
  Updated Feb 2011
  Changelog:
  
    1.0:
      Known bugs u still get a knife
      Initial release

-------------------------------------------------------
 --]]
 
 --Shrubbot min level to execute the command
 min_level     = 3
 
 --Max covert ops allowed (normal gameplay)
 maxcoverts = -1
 
 --[[
 Usage: 
 !stenwar on
 !stenwar off
 --]]
 stenwar_cmd 			= "!stenwar"
 
 
 --[[
 Set to "true" to enable it
 noreload = true
 noreload = false
 --]]
 noreload = false
 
 
 --Sound that get played if you enable stenwar
 sound =  "sound/chat/allies/953a.wav" 
 
 --------------------------------------------------------------------------------
 
--global vars
et.MAX_WEAPONS = 50
et.CS_PLAYERS = 689
samplerate = 200
STEN = 10
--

--note sme got no comments because it arent weapons
weapons = {
	false,		--WP_THROWABLE_KNIFE // 1
	false,	--WP_LUGER,				// 2
	false,	--WP_MP40,				// 3
	false,	--WP_GRENADE_LAUNCHER,		// 4
	false,	--WP_PANZERFAUST,			// 5
	false,	--WP_FLAMETHROWER,		// 6
	false,		--WP_COLT,				// 7	// equivalent american weapon to german luger
	false,	--WP_THOMPSON,			// 8	// equivalent american weapon to german mp40
	false,	--WP_GRENADE_PINEAPPLE,	/	// 9
	true,	--WP_STEN,				// 10	// silenced sten sub-machinegun
	true,		--WP_MEDIC_SYRINGE,		// 11	// JPW NERVE -- broken out from CLASS_SPECIAL per Id request
	true,		--WP_AMMO,				// 12	// JPW NERVE likewise
	false,	--WP_ARTY,				// 13
	false,	--WP_SILENCER,			// 14	// used to be sp5
	true,	--WP_DYNAMITE,			// 15
	nil,		--// 16
	nil,		--// 17
	nil,		--// 18
	true,		--WP_MEDKIT,			// 19
	true,	--WP_BINOCULARS,			// 20
	nil,		--// 21
	nil,		--// 22
	false,	--WP_KAR98,				// 23	// WolfXP weapons
	false,	--WP_CARBINE,			// 24
	false,	--WP_GARAND,			// 25
	false,	--WP_LANDMINE,			// 26
	true,	--WP_SATCHEL,			// 27
	true,	--WP_SATCHEL_DET,			// 28
	nil,		--// 29
	true,	--WP_SMOKE_BOMB,			// 30
	false,	--WP_MOBILE_MG42,			// 31
	false,	--WP_K43,				// 32
	false,	--WP_FG42,				// 33
	nil,		--// 34
	false,	--WP_MORTAR,			// 35
	nil,		--// 36
	false,	--WP_AKIMBO_COLT,			// 37
	false,	--WP_AKIMBO_LUGER,		// 38
	nil,		--// 39
	nil,		--// 40
	false,	--WP_SILENCED_COLT,		// 41
	false,	--WP_GARAND_SCOPE,		// 42
	false,	--WP_K43_SCOPE,			// 43
	false,	--WP_FG42SCOPE,			// 44
	false,	--WP_MORTAR_SET,			// 45
	true,	--WP_MEDIC_ADRENALINE,		// 46
	false,	--WP_AKIMBO_SILENCEDCOLT,	// 47
	false		--WP_AKIMBO_SILENCEDLUGER,	// 48
}

function et_InitGame(levelTime,randomSeed,restart)
	maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )   --gets the maxclients
	gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
	et.G_Print("[Stenwar] Version:"..Version.." Loaded
")
	et.RegisterModname(Modname .. "  " .. Version)
	blocker = 0
	if stenwar == nil then
		et.trap_Cvar_Set( "g_stenwar", "0" )
		et.trap_Cvar_Set( "team_maxcovertops", maxcoverts )
	end
end

-- called every server frame
function et_RunFrame( levelTime )
local stenwar = tonumber(et.trap_Cvar_Get( "g_stenwar" ))
		--et.trap_SendServerCommand(-1, "cp \"^w"..stenwar.."
\"") -- Debug to get stenwar value
if math.mod(levelTime, samplerate) ~= 0 then return end
   -- for all clients
   for j = 0, (maxclients - 1) do
      for k=1, (et.MAX_WEAPONS - 1), 1 do
		if stenwar == 1 then
         if not weapons[k] then
			if noreload then
			   et.gentity_set(j, "ps.ammoclip", 10, 32)
			end
            et.gentity_set(j, "ps.ammoclip", k, 0)
            et.gentity_set(j, "ps.ammo", k, 0)
            et.gentity_set(j, "ps.ammo", 10, 1337)
			et.gentity_set(j,"sess.latchPlayerType",4)
			if checkclass(j) ~= 4 and blocker == 0 then
				changeclass(j)
				changeweapon(j)
				SetHP()
				blocker = 1
			end
			latchweapon(j)
		 end
		end
	  end
	end
 end
 
function checkclass(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client, 4)
	return tonumber(et.Info_ValueForKey(cs, "c"))
end

function changeclass(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
	local infoclass = et.Info_SetValueForKey( cs, "c", 4 )
	et.trap_SetConfigstring(689 + client, infoclass)
end

function changeweapon(client)
   local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
	local infoweapon = et.Info_SetValueForKey( cs, "w", STEN )
	et.trap_SetConfigstring(689 + client, infoweapon)
end

function latchweapon(slot)
		local fallback -- default weapon
		if team == AXIS then 
			fallback = STEN
		else fallback = STEN
		end

		-- now update the client (in order for the change to be immidieate, and not wait for the server, we need to update the client's configstring)
		local infostring  
		infostring = et.trap_GetConfigstring(689 + slot)
		infostring = et.Info_SetValueForKey( infostring, "lw", fallback )
		et.trap_SetConfigstring(689 + slot, infostring)
		et.gentity_set(slot,"sess.latchPlayerWeapon",fallback)
end
 
 function getlevel(client)
	local lvl = et.G_shrubbot_level(client)
	if lvl >= min_level then
		return true
	elseif lvl < min_level then
		et.trap_SendServerCommand(client, "cpm \"^3Sorry, you don't have the right to execute this command
\" " )
		return false
	end
		return nil
end

function SetHP()
	for target = 0, (maxclients - 1) do
	local hp = tonumber(et.gentity_get(target,"health"))
	  if hp < 0 then
		return
	  else
		et.gentity_set(target, "health", -200)
	  end
	 end
end

function et_ClientCommand(client, command)
 local stenwar = tonumber(et.trap_Cvar_Get( "g_stenwar" ))
  if getlevel(client) then
	if et.trap_Argv(0) == "say" or et.trap_Argv(0) == "say_team" or et.trap_Argv(0) == "say_buddy" or et.trap_Argv(0) == "say_teamnl" then
	   	local s, e, type = string.find(et.trap_Argv(1), "^" .. stenwar_cmd .. " ([%w%_]+)$")
			if type == "on" and stenwar == 0 then
					et.trap_Cvar_Set( "g_stenwar", "1" )
					et.G_globalSound( sound )
					et.trap_SendServerCommand(-1, "chat \"^.stenwar: ^3stenwar ^1enabled\" " )
			elseif type == "off" and stenwar == 1 then
					et.trap_Cvar_Set( "g_stenwar", "0" )
					for j = 0, (maxclients - 1) do
						et.gentity_set(j, "ps.ammo", 10, 96)
					end
					et.trap_SendServerCommand(-1, "chat \"^.stenwar: ^3stenwar ^1disabled\" " )
			elseif type == "on" and stenwar == 1 then
					et.trap_SendServerCommand(client, "cpm \"^.stenwar: ^3stenwar ^wis already ^1on\" " )
			elseif type == "off" then
					et.trap_SendServerCommand(client, "cpm \"^.stenwar: ^3stenwar ^wmust be ^1on ^wbefore you can disable it\" " )
			end
			if string.lower(et.trap_Argv(1)) == stenwar_cmd then
				if string.lower(et.trap_Argv(2)) == "on" and stenwar == 0 then
					et.trap_Cvar_Set( "g_stenwar", "1" )
					et.trap_Cvar_Set( "team_maxcovertops", "-1" )
					et.G_globalSound( sound )
					et.trap_SendServerCommand(-1, "chat \"^.stenwar: ^3stenwar ^1enabled\" " )
				elseif string.lower(et.trap_Argv(2)) == "off" and stenwar == 1 then
					et.trap_Cvar_Set( "g_stenwar", "0" )
					et.trap_Cvar_Set( "team_maxcovertops", maxcoverts )
				    for j = 0, (maxclients - 1) do
						et.gentity_set(j, "ps.ammo", 10, 96)
					end
					et.trap_SendServerCommand(-1, "chat \"^.stenwar: ^3stenwar ^1disabled\" " )
				elseif string.lower(et.trap_Argv(2)) == "on" and stenwar == 1 then
					et.trap_SendServerCommand(client, "cpm \"^.stenwar: ^3stenwar ^wis already ^1on\" " )
				elseif string.lower(et.trap_Argv(2)) == "off" then
					et.trap_SendServerCommand(client, "cpm \"^.stenwar: ^3stenwar ^wmust be ^1on ^wbefore you can disable it\" " )
				elseif string.lower(et.trap_Argv(2)) == "" then
					et.trap_SendServerCommand(client, "cpm \"^3!stenwar ^1on/off\" " )
				end
			end
	end
  end
 return 0
end

This lua fixes the mapscript bug which could appear if players vote a map with upper letters and mapscript is lower letters. (Note: mapscripts must be lower letters now)

votefix.lua

Modname = "votefix"
Version = "0.1"
Author = "Perlo_0ung?!"

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print("[votefix] Version:"..Version.." Loaded
")
	et.RegisterModname(Modname .. " " .. Version)
end

et.CS_VOTE_STRING = 7

function et_Print(text)
	local t = ParseString(text)  --Vote Passed: Change map to suppLY
	if t[2] == "Passed:" and t[4] == "map" then 
		if string.find(t[6],"%u") == nil or t[6] ~= getCS() then return 1 end
			local mapfixed = string.lower(t[6]) 
			et.trap_SendConsoleCommand( et.EXEC_APPEND, "ref map " .. mapfixed .. "
" )
	end
end    
    
function ParseString(inputString)
	local i = 1
	local t = {}
	for w in string.gfind(inputString, "([^%s]+)%s*") do
		t[i]=w
		i=i+1
	end
	return t
 end

function getCS()
	local cs = et.trap_GetConfigstring(et.CS_VOTE_STRING)
	local t = ParseString(cs)
	return t[4]
end

randomspawn.lua


    spawndistance = 400
     
     
    function et_InitGame(levelTime,randomSeed,restart)
            mclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
            mapname = et.trap_Cvar_Get( "mapname" )
            local loadtable = loadfile(et.trap_Cvar_Get("fs_homepath") .. '/etpub/spawns/'..mapname..'.lua') --- load spawns table
            if loadtable ~= nil then
                    loadtable()
            else
                    --et.trap_SendServerCommand(-1, "chat \"^3LOADSPWANPOINTS^7: ^7No valid spawnsfile found for this map.\"" )
                    et.G_Print("WARNING: SPAWNPOINTS failed to load "..mapname..".lua
")
                    quit = 1
            end
    end
     
    function dist(a ,b)
       local dx = math.abs(b[1] - a[1])
       local dy = math.abs(b[2] - a[2])
       local dz = math.abs(b[3] - a[3])
       local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2))
       return math.floor(d / 52.4934)
    end
     
    function et_ClientSpawn(cno,revived)
            execute = 1
            if quit ~= 1 then
                    while execute == 1 do
                            rpos = {}
                            spawn = randomspawn()
                                    for i=0, mclients-1, 1 do
                                            if et.gentity_get(i,"pers.connected") == 2 and cno ~= i then
                                                    CurrentPos(i)                  
                                            end
                                    end
                            table.sort(rpos)
                    if rpos[1] == nil then execute = 0 break end
                    end
            et.gentity_set(cno, "origin", spawn)
            end
    end
     
    function randomspawn()
            local random = SPAWN[math.random(table.getn(SPAWN))]
            return random
    end
     
    function CurrentPos(cno)
            local cnopos = et.gentity_get(cno,"r.currentOrigin")
            distance = dist(cnopos,spawn)
            if distance > spawndistance then
                    table.insert(rpos,distance)
            end
    end

randomspawn.lua:
Make a folder in your mod folder named “spawns” and put the map lua files in there.
Example for oasis:

oasis.lua


SPAWN = {}
SPAWN[1] = {27, 2038, -325}
SPAWN[2] = {2405, 1752, -577}
SPAWN[3] = {3048, 1890, -458}
SPAWN[4] = {1433, 3880, -93}
SPAWN[5] = {5206, 4585, -835}
SPAWN[6] = {3372, 5834, -207}


(eiM) #2

nice stuff. The mapscript vote fix would have been handy a few years back :slight_smile:


(yaar103) #3

This lua fixes the mapscript bug which could appear if players vote a map with upper ladders and mapscript is lower letters.


(acQu) #4

Nice one there ^^


(Micha) #5

typofix.lua


--[[

	typofix.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu
	
	
	Info:
	--------------------
	This lua prevents to show of passwords to chat if you miss pressing shift and 7. Meaning typing 7ref or 7rcon 
	
	
--]]

Version = "0.1"

Modname = "Typofix"

-------//---------------------Start of functions----------------------------
function et_InitGame(levelTime,randomSeed,restart)
    et.G_Print("^z["..Modname.."^z] Version: "..Version.." Loaded
")
    et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
end

function et_ClientCommand(client, command)
    local argv1 = string.lower(et.trap_Argv(1))
	local conarg = et.ConcatArgs(1)
	
	-------//--------------------Commands----------------------------
	if string.find(argv1, "^7ref") or string.find(argv1, "^7rcon") then
		et.trap_SendServerCommand( client, "chat \"Ckeck your typing: '"..conarg.."'\"" )
		return 1
	end
	
    return 0
end

levlist.lua


--[[

	levlist.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu
	
	
	Info:
	--------------------
	This lua was made to show the admin levels via command on server.
	
	This lua was tested on etpub.
	
--]]

Modname = "Levlist"
Version = "0.1"

--[[
-------------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

true means on
false means off

changeable values:
--]]

cleanlevelname = 	false	--remove the color codes out of the shrubbot level name

adminlevel = 		6		--grant !levlist command to greater/same level as 'adminlevel' value

levlist_cmd = 	"!levlist"	--levlist command

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

et.CS_PLAYERS = 689
shrubname = {}
local shrubbotfile = et.trap_Cvar_Get( "g_shrubbot" )

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print("["..Modname.."] Version: "..Version.." Loaded
")
    et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
	
	ReadShrubNames()
end

function et_ClientCommand(clientNum, command)

local cmd = string.lower(command)
local arg1 = string.lower(et.trap_Argv(1))
local conarg = et.ConcatArgs(2)
  -- check if client is in list of allowed members
	if ( cmd == levlist_cmd and et.G_shrubbot_permission( clientNum, "3" ) ) or arg1 == ""..levlist_cmd.."" or string.find(arg1, "^"..levlist_cmd.."") then
		if et.G_shrubbot_level(clientNum) >= adminlevel then
			levlist(clientNum)
			if cmd == levlist_cmd then
				return 1
			end
		else
			et.trap_SendServerCommand(clientNum, 'chat "^3levlist^w: ^fpermission denied"' )
			return 1
		end
	end
	return 0
end

function levlist(clientNum)
	for value,key in pairs(shrubname) do
		local level = value
		local levelname = "^/'^f"..key.."^/'"
		et.trap_SendServerCommand( clientNum, string.format('print "^7%3s ^7%-30s
"', level, levelname  ))
	end
end

-- func from minipb by Hadro
function uncol(arg) -- this one leaves weird ascii, unlike et.Q_CleanStr
  return string.gsub(string.gsub(arg, "%^[^%^]", ""), "%^", "")
end

-- taken out of connect.lua by Phishermans Phriend
function et_Print(text)
	if string.sub(text,1,19) == "readconfig: loaded " then
		ReadShrubNames()
	end
end

function clearSpace(string)
	local output = ""
	local i = string.len(string)
	while (string.sub(string,i,i) == " " or string.sub(string,i,i) == "	") do
		string = string.sub(string,1,(i-1))
		i = i - 1
	end

	while (string.sub(string,1,1) == " " or string.sub(string,1,1) == "	") do
		string = string.sub(string,2)
	end

	i = 1
	while string.sub(string,i,i) ~= "" do
		if string.sub(string,i,i) ~= "\"" then
			output = output .. string.sub(string,i,i)
		end
		i = i + 1
	end
	return output
end

function ReadShrubNames()
	local level = ""
	local name = ""

	local fd, len = et.trap_FS_FOpenFile(shrubbotfile, et.FS_READ)

	if len > 1 then
		for line in string.gmatch(et.trap_FS_Read(fd, len), "([	%C]+)") do
			if clearSpace(line) == "[level]" then
				if level ~= "" then
					shrubname[level] = name
					level = ""
				end
				var = true
			elseif clearSpace(line) == "[ban]" or clearSpace(line) == "[mute]" or clearSpace(line) == "[admin]" or clearSpace(line) == "[command]" then
				if level ~= "" then
					shrubname[level] = name
					level = ""
				end
				var = false
			elseif var then
				for k,v in string.gmatch(line, "([	%C]*)=(.*)") do
					if clearSpace(k) == "level" then
						level = tonumber(clearSpace(v))
					elseif clearSpace(k) == "name" then
						if cleanlevelname then
							name = uncol(clearSpace(v))
						else
							name = clearSpace(v)
						end
					end
				end
			end
		end

		if level ~= "" then
			shrubname[level] = name
		end
	end
end

clanchat.lua


--[[

	clanchat.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu
	
	
	Info:
	--------------------
	This lua adds the /mc command to users with level 'member_level' and above. 
	Usage: /mc text
	
--]]

Modname = "Clan-chat"
Version = "0.3"

-------------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

chatcommand 	 = "mc"		--clan-chat command

member_level     = 7		--min. level needed to use chatcommand (/mc)
colour 			 = "N"		--message colour

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

function et_InitGame(levelTime, randomSeed, restart)
  et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
  
  maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients"))-1
end

function et_ClientCommand(clientNum, command) -- get client commands
local cmd = string.lower(command)
local arg1 = string.lower(et.trap_Argv(1))
local conarg = et.ConcatArgs(2)
  -- check if client is in list of allowed members
	if et.G_shrubbot_level(clientNum) >= member_level then
		if cmd == chatcommand or arg1 == "/"..chatcommand.."" or string.find(arg1, "^/"..chatcommand.."") then
			if et.trap_Argc() > 1 then
				-- build message
				local message = ""
				if cmd == chatcommand then
					for i = 1, et.trap_Argc() - 1, 1 do
						message = message .. et.trap_Argv(i) .. " "
					end
				elseif arg1 == "/"..chatcommand.."" then
						message = conarg
				elseif string.find(arg1, "^/"..chatcommand.."") then
					for i = 1, et.trap_Argc() - 1 , 1 do
						message = message .. et.trap_Argv(i) .. " "
						message = string.sub(message, (string.len(chatcommand)+3))
					end
				end
				-- send message to all other members
				for i = 0, maxclients, 1 do
					if et.G_shrubbot_level(i) >= member_level then
						sendstring = playerName(clientNum) .. " ^7(^8Clan-chat^7)^N: ^"..colour.."" .. message
						et.trap_SendServerCommand(i, "chat \"" .. sendstring .. "\"")
						if i == clientNum then
							et.trap_SendServerCommand(clientNum, "print \"^fYour clan-chat has been sent to all online clan-members
\"")
						elseif i ~= clientNum then
							et.trap_SendServerCommand(i, "cp \"^8You received a clan-chat message from ^7"..playerName(clientNum).."
\"")
						end
					end
				end
			else
				et.trap_SendServerCommand(clientNum, "print \"^"..colour.."usage: /"..chatcommand.." [message]
\"")
			end
			return 1
		end
	end
	return 0
end

function playerName(client) -- return a player's name
  local name = et.Info_ValueForKey(et.trap_GetUserinfo(client), "name")
  if name == "" then
    return "*unknown*"
  end
  return name
end

intermission.lua


--[[

	intermission.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu
	
	
	Info:
	--------------------
	This lua was made to print a repeating message at intermission
	
	Compatible: lua 5.2.*
	
--]]

Modname = "Intermission"
Version = "1.1"

-------------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

printonce = false								--true: print once
												--false: print repeating
timer = 8										--print each 'value' seconds the message

message = "^7Please vote for a map now"			--intermission message
location = "chat"								--location of the message

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------

--[[
bp - banner area
cp - centerprint area
cpm - left popup area
print - console
chat - player chat area
qsay - server say
--]]

-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

 
--global vars
samplerate = (timer*1000)
count = 0
active = false
--

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print("[Intermission] Version: "..Version.." Loaded
")
    et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
end

function et_Print(text)
	local t = ParseString(text)
    if t[1] == "ExitLevel:" or t[1] == "Exit:" then
		active = true
	end
end

function et_RunFrame( levelTime )
	if math.fmod(levelTime, samplerate) ~= 0 then return end
		if active then
			count = count + 1
			if printonce == false and math.fmod(count, samplerate) then
				et.trap_SendServerCommand( -1 , string.format('%s \"%s\"',location,message ))
			elseif printonce and blocker == nil then
				et.trap_SendServerCommand( -1 , string.format('%s \"%s\"',location,message ))
				blocker = 1
			end
		end
end

--------------------------HELPER FUNCTIONS------------------------------------------------------------------

function ParseString(inputString)
    local i = 1
    local t = {}
    for w in string.gmatch(inputString, "([^%s]+)%s*") do
        t[i]=w
        i=i+1
    end
    return t
 end

function getCS()
    local cs = et.trap_GetConfigstring(et.CS_VOTE_STRING)
    local t = ParseString(cs)
    return t[3]
end


(Micha) #6

userinfo.lua


--[[

	userinfo.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu
	
	
	Info:
	--------------------
	This lua was made to give a certain level the power to use silent !userinfo and !listplayers (/!userinfo /!listplayers)
	without granting them to use all commands silently. This may help to get infos about suspicious players.
	
	This lua was tested on etpub and infected mod.
	
--]]

Modname = "Userinfo"
Version = "0.8"

--[[
-------------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------

true means on
false means off

changeable values:
--]]

useautodetect = 	false	--use auto detecting (meaning it grants the rights if user is allowed to use flag e/i but not flag 3)
adminlevel = 		6		--gets activated if 'useautodetect = false'
							--grant silent !userinfo and !listplayers at greater/same level as 'adminlevel' value
							
showfullip	=		true	--set true to show full ip of user. set false to show just the first three numbers.

cleanlevelname = 	false	--remove the color codes out of the shrubbot level name using /!userinfo

uncolname = 		false	--remove the color codes out of the player name using /!list and /!userinfo

akalistplayers = 	true	--print a.k.a. at /!list command (This can cause heavy load on server)

--shortened listplayers commands
listplayers_cmd = 	"!list"	--(!list !listp !listpl !listpla !listplay !listplaye) will work now. !listplayers shows normal mod list

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

et.CS_PLAYERS = 689
clientversion = {}
shrubname = {}
local shrubbotfile = et.trap_Cvar_Get( "g_shrubbot" )

function et_InitGame(levelTime,randomSeed,restart)
	et.G_Print("["..Modname.."] Version: "..Version.." Loaded
")
    et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
	
	ReadShrubNames()
	
	for cno = 0, tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) - 1 do
		clientversion[cno] = "*unknown*"
	end
end

function et_ClientCommand(client, command)
    local cmd = string.lower(command)
	
	if et.G_shrubbot_level(client) >= adminlevel and useautodetect == false then
		if cmd == "!userinfo" then
			userinfo(cmd,client)
			return 1
		end
	
		if string.find(cmd, "^"..listplayers_cmd.."") then
			listplayers(client)
			return 1
		end
	elseif useautodetect then
		if cmd == "!userinfo" and et.G_shrubbot_permission( client, "3" ) == 0 and et.G_shrubbot_permission( client, "e" ) == 1 then
			userinfo(cmd,client)
			return 1
		end
	
		if string.find(cmd, "^"..listplayers_cmd.."") and et.G_shrubbot_permission( client, "3" ) == 0 and et.G_shrubbot_permission( client, "i" ) == 1 then
			listplayers(client)
			return 1
		end
	end
	
	if et.G_shrubbot_permission( clientNum, "i" ) == 1 then
		if (string.find(et.trap_Argv(0), "^/" .. listplayers_cmd .. "") or string.find(et.trap_Argv(1), "^/" .. listplayers_cmd .. "")) and not string.find(et.trap_Argv(1), "^!listplayers") then
			listplayers(client)
			return 1
		end
		if string.find(et.trap_Argv(1), "^" .. listplayers_cmd .. "") and not string.find(et.trap_Argv(1), "^!listplayers") then
			listplayers(client)
		end
	end
	
	return 0
end

function et_ClientConnect( cno, firstTime, isBot )
	local userinfo = et.trap_GetUserinfo(cno)
	local protocol = tostring(et.Info_ValueForKey(userinfo, "protocol"))
    if protocol == nil or protocol == "" then
		clientversion[cno] = "*unknown*"
	elseif protocol == "82" then
		clientversion[cno] = "2.55"
	elseif protocol == "83" then
		clientversion[cno] = "2.56"
	elseif protocol == "84" then
		clientversion[cno] = "2.6b"
	end				
end

function userinfo(params,PlayerID)

	local params = {}
	local i=1
	-- if et.trap_Argv(i) is empty, it returns "" (and not nil!)
	while string.lower(et.trap_Argv(i)) ~= "" do
		params[i] =  string.lower(et.trap_Argv(i))
		i=i+1
	end
	
		if ( params[1] ~= nil ) then
		
			local client = tonumber(params[1])
			if client then
				if (client >= 0) and (client < 64) then 
					if et.gentity_get(client,"pers.connected") ~= 2 then 
						et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo^w: ^fThere is no client associated with this slot number
"' )
						return 
					end 
	
				else              
					et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo^w: ^fPlease enter a slot number between 0 and 63
"' )
					return 
				end 
			end
			if client == nil then -- its a player's name
				s,e=string.find(params[1], params[1])
				e = e or 0
				if e <= 2 then
					et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo^w: ^fPlayer name requires more than 2 characters
"' )
					return
				else
					client = getPlayernameToId(params[1])
				end
			end
			-- either a slot or the victim doesnt exist
			if client ~= nil then
				if tonumber(client) == nil then
					et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo^w: ^fMore then 1 Player with name ^w'..params[1]..' ^fon the server!^7
"')
					return
				end
					local userinfo = et.trap_GetUserinfo(client)
    
					if (userinfo ~= "") then
						if isBot(client) then
							ip = "*OMNIBOT*"
							akanamehold = ""
						else
							ip = et.Info_ValueForKey(userinfo,"ip")
							akanamehold = cut_nick(akaname(et.Info_ValueForKey(userinfo,"cl_guid"),et.Info_ValueForKey(userinfo,"name")))
							if PlayerID ~= 1022 and showfullip == false then    
								s, e, ip = string.find( ip, "(%d+%.%d+%.%d+%.)" )
								ip = ""..ip.."*"
							end
						end
						if uncolname then
							name = uncol(et.Info_ValueForKey(userinfo,"name"))
						else
							name = et.Info_ValueForKey(userinfo,"name")
						end
						
						local guid = string.sub(et.Info_ValueForKey(userinfo,"cl_guid"),-8)
						if guid == nil then
							guid = "None"
						end
						local mac = et.Info_ValueForKey(userinfo,"mac")
						if mac == nil or mac == "" then
							mac = "None"
						elseif mac == "" then
							mac = "*OMNIBOT*"
						end
						local punkbuster = et.Info_ValueForKey(userinfo,"cl_punkbuster")
						if punkbuster == nil then
							punkbuster = "None"
						elseif punkbuster == "1" then
							punkbuster = "Yes"
						else
							punkbuster = "No"
						end
						local gamename = string.lower(et.trap_Cvar_Get( "gamename"))
						if gamename == "etpub" or gamename == "infected" or gamename == "hideNseek" then
							etversion = et.gentity_get(client,"pers.etpubc")
						else
							etversion = et.Info_ValueForKey(userinfo,"cg_etVersion")
						end
						if etversion == nil then
							etversion = "None"
						elseif etversion == "" then
							etversion = "*unknown*"
						elseif etversion == 0 then
							etversion = "*OMNIBOT*"
						end
						
						local countryCode = et.gentity_get( client, "sess.uci" )
						local countryName = countries[countryCode]

						if countryName then
							country = countryName
						else
							country = countryCode
						end
						
						local level = tonumber(et.G_shrubbot_level(client))
						local levelname = "^/'^f"..shrubname[level].."^/'"
						
						if PlayerID == 1022 then
							et.G_LogPrint(string.format("^/^LUA Userinfo of user ^f"..name.." "..akanamehold.."
^/Slot Number: ^f"..client.." 
^/Mod Version:  ^f"..etversion.."   ^/Client Version: ^f"..clientversion[client].." 
^/Punkbuster:  ^f"..punkbuster.."   ^/GUID: ^f*"..guid.." 
^/IP:   ^f"..ip.." 
^/MAC:  ^f"..mac.."  
^/Country:  ^f"..country.." 
^/Level:    ^f"..level.." ^/- ^f"..levelname.." ^7
"))	
						else	
							et.trap_SendServerCommand(PlayerID, 'print "^/LUA Userinfo of user ^f'..name..' '..akanamehold..'
^/Slot Number: ^f'..client..' 
^/Mod Version:  ^f'..etversion..'   ^/Client Version: ^f'..clientversion[client]..' 
^/Punkbuster:  ^f'..punkbuster..' 
^/GUID: ^f*'..guid..' 
^/IP:^    ^f'..ip..' 
^/MAC:  ^f'..mac..' 
^/Country:  ^f'..country..' 
^/Level:    ^f'..level..' ^/- ^f'..levelname..' ^7
"')
						end
						return
					end
				
			else
				if getPlayernameToId(client) == nil then
					et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo^w: '..params[1]..'^f is not on the server!^7
"')
					return
				end
			end
		else
		
			et.trap_SendServerCommand(PlayerID, 'print "^3Userinfo: ^7Usage: ^f/!userinfo [name]
"' )
			et.trap_SendServerCommand(PlayerID, 'print "                 ^f/!userinfo [ID]
"' )
			return
		end
end


function listplayers(PlayerID)
	
	local playercount = 0
	local speccount = 0
	local cntcount = 0
	local countbots = 0
	local state = ""
	
	if PlayerID ~= 1022 then
		et.trap_SendServerCommand(PlayerID, 'print "^/LUA listplayers:^7
"')
	end
	
	for i=0, tonumber(et.trap_Cvar_Get("sv_maxClients"))-1, 1 do
	  
		if (et.gentity_get(i,"pers.connected") ~= 0) then
	  
		local team = tonumber(et.gentity_get(i,"sess.sessionTeam"))
		local ref = tonumber(et.gentity_get(i,"sess.referee"))
		local muted = tonumber(et.gentity_get(i,'sess.muted'))
		local level = tonumber(et.G_shrubbot_level(i))
		local levelname = "^/'^7"..uncol(shrubname[level]).."^/'" --always uncol for better list look
		
    	local userinfo = et.trap_GetUserinfo(i)
    
		if (userinfo ~= "") then
			local privpass = et.trap_Cvar_Get("sv_privatepassword")
			local guid = et.Info_ValueForKey(userinfo,"cl_guid")
			local pass = et.Info_ValueForKey(userinfo,"password")
			if uncolname then
				cname = trim(uncol(et.Info_ValueForKey(userinfo, "name" )))
			else
				cname = trim(et.Info_ValueForKey(userinfo, "name" ))
			end
			
			if akalistplayers and not isBot(i) then
				akanamehold = cut_nick(akaname(guid,cname))
			else
				akanamehold = ''
			end
			
			cname = cut_nick(cname)
    					
			if ref == 1 then
				state = " ^3REF "
			elseif muted == 1 then
				state = "^5muted"
			elseif pass == privpass and privpass ~= nil and privpass ~= "" then
				state = " ^3PRV "
			end
		
			if team == 1 then
				team = "^1R"
			elseif team == 2 then
				team = "^4B"
			else
				team = "^3S"
						               
				if et.gentity_get(i,"pers.connected") == 2 then
					speccount = speccount + 1
				end
						               
			end
			
			if (string.sub (guid, 25,32 )) == "00000000" then
				guid = "000000000000000000000000OMNIBOT*"
			end

			if et.gentity_get(i,"pers.connected") < 2 then
				if PlayerID ~= 1022 then
					et.trap_SendServerCommand( PlayerID, string.format('print "^7%2d ^3>>>>>>>> Connecting <<<<<<<<   ^7(^7*%8s^7)  ^7%-18s %-5s
"', i, (string.sub (guid, 25,32 )), cname, state  ))
				end
				cntcount = cntcount + 1
							
			else
				if PlayerID ~= 1022 then
					et.trap_SendServerCommand( PlayerID, string.format('print "^7%2d ^7%s ^7%3s ^7%-30s ^7(^7*%8s^7)  ^7%-18s %s %-5s
"', i, team, level, levelname, (string.sub (guid, 25,32 )), cname, akanamehold, state  ))
				end
				playercount = playercount + 1
								
			end
			
			if isBot(i) then
				countbots = countbots + 1
			end
		
		end
		end
	state = ""
	end

    local playing = playercount - speccount
	if PlayerID ~= 1022 then
		et.trap_SendServerCommand(PlayerID, string.format('print "
^/%2d ^7Total [ ^/%2d ^7playing, ^/%3d ^7spectating, ^/%3d ^7connecting, ^/%3d ^7bots ]

"',playercount+cntcount,playing,speccount,cntcount,countbots))
	end

end

--helper functions listplayers

-- func from minipb by Hadro
function uncol(arg) -- this one leaves weird ascii, unlike et.Q_CleanStr
  return string.gsub(string.gsub(arg, "%^[^%^]", ""), "%^", "")
end

-- func from minipb by Hadro
function trim(arg) -- remove spaces in front and after
  return string.gsub(arg, "^%s*(.-)%s*$", "%1")
end

function cut_nick(oldname)

local max_nick = 99
local clean_oldname = trim ( uncol ( oldname ) )
local nick_len = string.len(clean_oldname)
local newname_aftercut

	if (nick_len > max_nick) then
    
	local name = string.sub (oldname, 0, max_nick )
	newname_aftercut = "" .. name .. "^7..."
	return newname_aftercut	
	else
	return oldname	
	end		

end
--

--bot detection
function isBot(playerID)
	local guid = et.Info_ValueForKey(et.trap_GetUserinfo(playerID),"cl_guid")
    if et.gentity_get(playerID,"pers.connected") == 2 and et.gentity_get(playerID,"ps.ping") == 0 and (string.sub (guid, 25,32 )) == "00000000" then
		return true
    end
end

--helper functions userinfo

function getPlayernameToId(name) 
	local i = 0
	local slot = nil
	local matchcount = 0
	if name == nil then
		return nil
	end
	local name = string.lower(et.Q_CleanStr( name ))
	local temp
	for i=0,tonumber(et.trap_Cvar_Get("sv_maxclients"))-1,1 do 
 			temp = string.lower(et.Q_CleanStr( et.Info_ValueForKey(et.trap_GetUserinfo(i), "name") ))
 			s,e=string.find(temp, name)
     			if s and e then 
					matchcount = matchcount + 1
					slot = i
        		end 
	end
	if matchcount >= 2 then
		return "foundmore"
	else
		return slot
	end
end

function akaname(guid,cname)
	local fd,len = et.trap_FS_FOpenFile( ""..shrubbotfile.."", et.FS_READ )
	if len <= 0 then
		et.G_Print("WARNING: No Data Defined! 
")
	else
		
		local filestr = et.trap_FS_Read( fd, len )
		et.trap_FS_FCloseFile( fd )
		
		local namename
		local guidshrub
		local guidname
		local nameshrub

		for namename, nameshrub, guidname, guidshrub in string.gmatch(filestr, "(%a+)%s*%=%s*([^%
]*)%s(%a+)%s+%=%s*(%x+)") do
			if string.find(guidshrub, guid) and not string.find(uncol(cname), uncol(nameshrub)) then
				if uncolname then
					return "^7(a.k.a. "..uncol(nameshrub).."^7)"
				else
					return "^7(a.k.a. "..nameshrub.."^7)"
				end
			end
		end

	end
	return ''
end


--taken out of connect.lua by Phishermans Phriend
function et_Print(text)
	if string.sub(text,1,19) == "readconfig: loaded " then
		ReadShrubNames()
	end
end

function clearSpace(string)
	local output = ""
	local i = string.len(string)
	while (string.sub(string,i,i) == " " or string.sub(string,i,i) == "	") do
		string = string.sub(string,1,(i-1))
		i = i - 1
	end

	while (string.sub(string,1,1) == " " or string.sub(string,1,1) == "	") do
		string = string.sub(string,2)
	end

	i = 1
	while string.sub(string,i,i) ~= "" do
		if string.sub(string,i,i) ~= "\"" then
			output = output .. string.sub(string,i,i)
		end
		i = i + 1
	end
	return output
end

function ReadShrubNames()
	local level = ""
	local name = ""

	local fd, len = et.trap_FS_FOpenFile(shrubbotfile, et.FS_READ)

	if len > 1 then
		for line in string.gmatch(et.trap_FS_Read(fd, len), "([	%C]+)") do
			if clearSpace(line) == "[level]" then
				if level ~= "" then
					shrubname[level] = name
					level = ""
				end
				var = true
			elseif clearSpace(line) == "[ban]" or clearSpace(line) == "[mute]" or clearSpace(line) == "[admin]" or clearSpace(line) == "[command]" then
				if level ~= "" then
					shrubname[level] = name
					level = ""
				end
				var = false
			elseif var then
				for k,v in string.gmatch(line, "([	%C]*)=(.*)") do
					if clearSpace(k) == "level" then
						level = tonumber(clearSpace(v))
					elseif clearSpace(k) == "name" then
						if cleanlevelname then
							name = uncol(clearSpace(v))
						else
							name = clearSpace(v)
						end
					end
				end
			end
		end

		if level ~= "" then
			shrubname[level] = name
		end
	end
end

-------//---------------------Country table----------------------------
-------//-------------made by by Phishermans Phriend-------------------
countries = {
[0]=    "Unknown",
[1]=    "Asia/Pacific Region", 
[2]=    "Europe", 
[3]=    "Andorra", 
[4]=    "United Arab Emirates",
[5]=    "Afghanistan", 
[6]=    "Antigua and Barbuda", 
[7]=    "Anguilla", 
[8]=    "Albania", 
[9]=    "Armenia",
[10]=    "Netherlands Antilles", 
[11]=    "Angola", 
[12]=    "Antarctica", 
[13]=    "Argentina", 
[14]=    "American Samoa",
[15]=    "Austria", 
[16]=    "Australia", 
[17]=    "Aruba", 
[18]=    "Azerbaijan", 
[19]=    "Bosnia and Herzegovina",
[20]=    "Barbados", 
[21]=    "Bangladesh", 
[22]=    "Belgium", 
[23]=    "Burkina Faso", 
[24]=    "Bulgaria", 
[25]=    "Bahrain",
[26]=    "Burundi", 
[27]=    "Benin", 
[28]=    "Bermuda", 
[29]=    "Brunei Darussalam", 
[30]=    "Bolivia", 
[31]=    "Brazil",
[32]=    "Bahamas", 
[33]=    "Bhutan", 
[34]=    "Bouvet Island", 
[35]=    "Botswana", 
[36]=    "Belarus", 
[37]=    "Belize",
[38]=    "Canada", 
[39]=    "Cocos (Keeling) Islands", 
[40]=    "Congo-Kinshasa",
[41]=    "Central African Republic", 
[42]=    "Congo-Brazzaville", 
[43]=    "Switzerland", 
[44]=    "Cote D'Ivoire", 
[45]=    "Cook Islands",
[46]=    "Chile", 
[47]=    "Cameroon", 
[48]=    "China", 
[49]=    "Colombia", 
[50]=    "Costa Rica", 
[51]=    "Cuba", 
[52]=    "Cape Verde",
[53]=    "Christmas Island", 
[54]=    "Cyprus", 
[55]=    "Czech Republic", 
[56]=    "Germany", 
[57]=    "Djibouti",
[58]=    "Denmark", 
[59]=    "Dominica", 
[60]=    "Dominican Republic", 
[61]=    "Algeria", 
[62]=    "Ecuador", 
[63]=    "Estonia",
[64]=    "Egypt", 
[65]=    "Western Sahara", 
[66]=    "Eritrea", 
[67]=    "Spain", 
[68]=    "Ethiopia", 
[69]=    "Finland", 
[70]=    "Fiji",
[71]=    "Falkland Islands (Malvinas)", 
[72]=    "Micronesia", 
[73]=    "Faroe Islands",
[74]=    "France", 
[75]=    "France, Metropolitan", 
[76]=    "Gabon", 
[77]=    "United Kingdom",
[78]=    "Grenada", 
[79]=    "Georgia", 
[80]=    "French Guiana", 
[81]=    "Ghana", 
[82]=    "Gibraltar", 
[83]=    "Greenland",
[84]=    "Gambia", 
[85]=    "Guinea", 
[86]=    "Guadeloupe", 
[87]=    "Equatorial Guinea", 
[88]=    "Greece", 
[89]=    "South Georgia and the South Sandwich Islands",
[90]=    "Guatemala", 
[91]=    "Guam", 
[92]=    "Guinea-Bissau",
[93]=    "Guyana", 
[94]=    "Hong Kong", 
[95]=    "Heard Island and McDonald Islands", 
[96]=    "Honduras",
[97]=    "Croatia", 
[98]=    "Haiti", 
[99]=    "Hungary", 
[100]=    "Indonesia", 
[101]=    "Ireland", 
[102]=    "Israel", 
[103]=    "India",
[104]=    "British Indian Ocean Territory", 
[105]=    "Iraq", 
[106]=    "Iran",
[107]=    "Iceland", 
[108]=    "Italy", 
[109]=    "Jamaica", 
[110]=    "Jordan", 
[111]=    "Japan", 
[112]=    "Kenya", 
[113]=    "Kyrgyzstan",
[114]=    "Cambodia", 
[115]=    "Kiribati", 
[116]=    "Comoros", 
[117]=    "Saint Kitts and Nevis", 
[118]=    "North Korea",
[119]=    "South Korea", 
[120]=    "Kuwait", 
[121]=    "Cayman Islands",
[122]=    "Kazakhstan", 
[123]=    "Laos", 
[124]=    "Lebanon", 
[125]=    "Saint Lucia",
[126]=    "Liechtenstein", 
[127]=    "Sri Lanka", 
[128]=    "Liberia", 
[129]=    "Lesotho", 
[130]=    "Lithuania", 
[131]=    "Luxembourg",
[132]=    "Latvia", 
[133]=    "Libya", 
[134]=    "Morocco", 
[135]=    "Monaco", 
[136]=    "Moldova",
[137]=    "Madagascar", 
[138]=    "Marshall Islands", 
[139]=    "Macedonia",
[140]=    "Mali", 
[141]=    "Burma", 
[142]=    "Mongolia", 
[143]=    "Macau", 
[144]=    "Northern Mariana Islands",
[145]=    "Martinique", 
[146]=    "Mauritania", 
[147]=    "Montserrat", 
[148]=    "Malta", 
[149]=    "Mauritius", 
[150]=    "Maldives",
[151]=    "Malawi", 
[152]=    "Mexico", 
[153]=    "Malaysia", 
[154]=    "Mozambique", 
[155]=    "Namibia", 
[156]=    "New Caledonia",
[157]=    "Niger", 
[158]=    "Norfolk Island", 
[159]=    "Nigeria", 
[160]=    "Nicaragua", 
[161]=    "Netherlands", 
[162]=    "Norway",
[163]=    "Nepal", 
[164]=    "Nauru", 
[165]=    "Niue", 
[166]=    "New Zealand", 
[167]=    "Oman", 
[168]=    "Panama", 
[169]=    "Peru", 
[170]=    "French Polynesia",
[171]=    "Papua New Guinea", 
[172]=    "Philippines", 
[173]=    "Pakistan", 
[174]=    "Poland", 
[175]=    "Saint Pierre and Miquelon",
[176]=    "Pitcairn Islands", 
[177]=    "Puerto Rico", 
[178]=    "Palestinian Territory",
[179]=    "Portugal", 
[180]=    "Palau", 
[181]=    "Paraguay", 
[182]=    "Qatar", 
[183]=    "Reunion", 
[184]=    "Romania",
[185]=    "Russian Federation", 
[186]=    "Rwanda", 
[187]=    "Saudi Arabia", 
[188]=    "Solomon Islands",
[189]=    "Seychelles", 
[190]=    "Sudan", 
[191]=    "Sweden", 
[192]=    "Singapore", 
[193]=    "Saint Helena", 
[194]=    "Slovenia",
[195]=    "Svalbard and Jan Mayen", 
[196]=    "Slovakia", 
[197]=    "Sierra Leone", 
[198]=    "San Marino", 
[199]=    "Senegal",
[200]=    "Somalia", 
[201]=    "Suriname", 
[202]=    "Sao Tome and Principe", 
[203]=    "El Salvador", 
[204]=    "Syria",
[205]=    "Swaziland", 
[206]=    "Turks and Caicos Islands", 
[207]=    "Chad", 
[208]=    "French Southern Territories",
[209]=    "Togo", 
[210]=    "Thailand", 
[211]=    "Tajikistan", 
[212]=    "Tokelau", 
[213]=    "Turkmenistan",
[214]=    "Tunisia", 
[215]=    "Tonga", 
[216]=    "Timor-Leste", 
[217]=    "Turkey", 
[218]=    "Trinidad and Tobago", 
[219]=    "Tuvalu",
[220]=    "Taiwan", 
[221]=    "Tanzania", 
[222]=    "Ukraine",
[223]=    "Uganda", 
[224]=    "United States Minor Outlying Islands", 
[225]=    "United States", 
[226]=    "Uruguay",
[227]=    "Uzbekistan", 
[228]=    "Holy See (Vatican City State)", 
[229]=    "Saint Vincent and the Grenadines",
[230]=    "Venezuela", 
[231]=    "Virgin Islands, British", 
[232]=    "Virgin Islands, U.S.",
[233]=    "Vietnam", 
[234]=    "Vanuatu", 
[235]=    "Wallis and Futuna", 
[236]=    "Samoa", 
[237]=    "Yemen", 
[238]=    "Mayotte",
[239]=    "Serbia", 
[240]=    "South Africa", 
[241]=    "Zambia", 
[242]=    "Montenegro", 
[243]=    "Zimbabwe",
[244]=    "Anonymous Proxy",
[245]=    "Satellite Provider",
[246]=    "Other",
[247]=    "Aland Islands",
[248]=    "Guernsey",
[249]=    "Isle of Man",
[250]=    "Jersey",
[251]=    "Saint Barthelemy",
[252]=    "Saint Martin",
[255]=    "Localhost",
}

Thanks go to kmod+ by Necromancer and Phishermans Phriend.

scoreboard.lua


Modname = "Scoreboard"
Version = "0.7"
Author  = "Micha!" --aka. MNwa!
--Contact:	http://www.teammuppet.eu/home/index.php?/user/1290-micha/
--			http://forums.warchest.com/member.php/52875-Micha

--Baserace Score Announce

--Note: This lua will only work if the mapname includes "baserace"

--Updated to Lua 5.2.1
--string.gfind was renamed to string.gmatch
--math.mod is now math.fmod

-------------------------------------------------------------------------------------
-------------------------------CONFIG START------------------------------------------
-------------------------------------------------------------------------------------

printlocation 	= "cpm"												--Scoreboard print location
																	--[[
																	Notice: 
																	bp = banner print
																	cp = center screen
																	cpm = popup message area
																	chat = chat area
																	--]]
																	
printtime		= 15												--print rhythm in seconds

-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------


-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------

-------//-----------------DO NOT CHANGE THESE VARS-----------------------------------
samplerate = (printtime *1000)										--global refresh rate												--search for mapname which include baserace
active = false
text = ""
--

function et_InitGame( levelTime,randomSeed,restart )
	et.G_Print("[SB] Version: "..Version.." Loaded
")
	et.RegisterModname(Modname .. " " .. Version)
	maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )	--get the maxclients
	gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))			--get the gamestate (warmup,etc)
	mapname = string.lower(et.trap_Cvar_Get( "mapname" ))			--get the mapname
	if gamestate == 0 then
		et.trap_Cvar_Set( "b_scoreboard_axis", "0" )
		et.trap_Cvar_Set( "b_scoreboard_allies", "0" )
	end
	if string.find(mapname, "^baserace") then
		active = true
	end
end

function et_RunFrame( levelTime ) 
	if math.fmod(levelTime, samplerate) ~= 0 then return end
		if active and gamestate == 0 then
			
			local sbax = et.trap_Cvar_Get( "b_scoreboard_axis" )	--ScoreBoard Axis
			local sbal = et.trap_Cvar_Get( "b_scoreboard_allies" )	--ScoreBoard Allies
			
			--AXIS SCORE
			if sbax >= "1" and sbax < "5" then
				text = "^NThe ^1Axis ^Nare ahead by ^1"..sbax.."^N!
"
				text = "^NThe ^1Axis ^Nare ahead by ^1"..sbax.."^N!
"
			end
			if sbax >= "5" then
				text = "^NThe ^1Axis ^Nhave a commanding ^1lead^N!
"
				text = "^NThe ^1Axis ^Nhave a commanding ^1lead^N!
"
			end
			
			--ALLIES SCORE
			if sbal >= "1" and sbal < "5" then
				text = "^NThe ^5Allies ^Nare ahead by ^1"..sbal.."^N!
"
				text = "^NThe ^5Allies ^Nare ahead by ^1"..sbal.."^N!
"
			end
			if sbal >= "5" then
				text = "^NThe ^5Allies ^Nhave a commanding ^1lead^N!
"
				text = "^NThe ^5Allies ^Nhave a commanding ^1lead^N!
"
			end
			
			--TIED
			if sbax == "0" and sbal == "0" then
				text = "^NThe Score is ^2Tied^N!
"
				text = "^NThe Score is ^2Tied^N!
"
			end
			
			et.trap_SendServerCommand( -1 , string.format('%s \"%s\"',printlocation,text ))
			et.trap_SendServerCommand( -1 , string.format('%s \"%s\"',"print",text ))
			
		end
end


function et_Print(text)

	--AXIS SCORE
	local sbaxc
	for sbaxc in string.gmatch(text, "The Axis are ahead by (%x)") do
		et.trap_Cvar_Set( "b_scoreboard_axis", sbaxc )
	end
	
	for sbaxc in string.gmatch(text, "The Axis have a commanding lead!") do
		et.trap_Cvar_Set( "b_scoreboard_axis", "5" )
	end
	
	--ALLIES SCORE
	local sbalc
	for sbalc in string.gmatch(text, "The Allies are ahead by (%x)") do
		et.trap_Cvar_Set( "b_scoreboard_allies", sbalc )
	end
	
	for sbalc in string.gmatch(text, "The Allies have a commanding lead!") do
		et.trap_Cvar_Set( "b_scoreboard_allies", "5" )
	end
	
	--TIED
	local tied
	for tied in string.gmatch(text, "The Score is Tied!") do
		et.trap_Cvar_Set( "b_scoreboard_axis", "0" )
		et.trap_Cvar_Set( "b_scoreboard_allies", "0" )
	end
	
end    


(NovaPrime) #7

the random spawn, I am assuming it does what it is called, spawn the player in random locations? if so that sounds really nice. what happens if they try to choose a location in mini-map?


(Teuthis) #8

[QUOTE=Micha;421767]I thought of to give some usefull scripts to everyone since I stopped playing ET.
HideNseek pack and my infected mod will come soon.

[/QUOTE]

I hope tis is only a temporary decision :)

(Micha) #9

Yes it does. It spawns the teams at the random position. You can set them map wise. It doesn’t matter what they pick as spawnpoint.
I use this method for my infected mod to let “infected” (axis) spawn at the location I want.
http://mnwa.bplaced.net/ftpfiles/Lua/axisspawn.lua
And the folder “axisspawns” http://mnwa.bplaced.net/ftpfiles/Lua/axisspawns/