WolfDB

Your Filebase for Games like Return to Castle Wolfenstein , Enemy Territory and more ...

Extra Stats

Show Lua Code
--[[

	extraStats.lua
	===================
	by Micha!

	
	Contact:
	--------------------
	http://www.teammuppet.eu


	Info:
	--------------------
	This lua grants extra ammo and extra health based on admin level.


	Further information:
	--------------------
	http://forums.warchest.com/showthread.php/47302-increase-ammo-and-health-based-on-admin-level

--]]

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

--[[-----//---------------------stats table----------------------------
	Set extra_health = 0 and/or extra_ammo = 0 if you do not want to grant additional benefits.
	The following is just an example of benefits.
--]]
stats_table = {
	{ admin_lvl = 0, extra_health = 0, extra_ammo = 0, },
	{ admin_lvl = 1, extra_health = 10, extra_ammo = 10, },
	{ admin_lvl = 2, extra_health = 20, extra_ammo = 20, },
	{ admin_lvl = 3, extra_health = 30, extra_ammo = 30, },
	{ admin_lvl = 13, extra_health = 40, extra_ammo = 40, },
}

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


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

Modname = "extraStats"
Version = "1.0"
Author = "Micha!"
local amount_weapons = 49

function et_InitGame(levelTime,randomSeed,restart)
    maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) - 1
    et.G_Print("^z["..Modname.."^z] Version: "..Version.." Loaded\n")
    et.RegisterModname(et.Q_CleanStr(Modname).."   "..Version.."   "..et.FindSelf())
    et.G_LogPrint("["..Modname.."] created by "..Author.."\n" )
end

function et_ClientSpawn(cno,revived)
	for _, line in ipairs(stats_table) do
		if et.G_shrubbot_level(cno) == line.admin_lvl then
			-------//--------------------Extra ammo------------------------------
			for k = 1, amount_weapons do
				et.gentity_set(cno, "ps.ammo", k, (et.gentity_get(cno, "ps.ammo", k) + line.extra_ammo))
			end
			-------//--------------------Extra health----------------------------
			local current_health = et.gentity_get(cno, "health")
			if checkclass(cno) == 1 then
				et.gentity_set(cno, "ps.stats", 4, current_health + line.extra_health - (line.extra_health/10))
			else
				et.gentity_set(cno, "ps.stats", 4, current_health + line.extra_health)
			end
			et.gentity_set(cno, "health", current_health + line.extra_health)
		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


DOWNLOAD

File size: 0 MB

Description:
Extra Stats