Spoiler -------------------------------------
-- One in the Chamber v1.0 --
-- Made by: Anders4000 --
-------------------------------------
-- Don't edit this script without --
-- my permission, only the --
-- settings. --
-- You are allowed to use this --
-- script on your server, and I --
-- hope you will, Have fun! (: --
-------------------------------------
--EDIT THESE SETTINGS TO YOUR LIKING!
--Settingname --Setting --Standard setting
StartingLives = 3 --3 (integer)
StartingBullets = 1 --1 (integer)
NextMapType = 1 --1 (1 = Restart map, 2 = Next map)
Maps = {"de_dust","de_dust2"} --{"de_dust","de_dust2"}
RandomSpawns = 1 --1 (1 = Yes, 0 = No. 0 is only recommended if you made spawns yourself.)
--END OF SETTINGS
function Array(m,v)
local array = {}
if v == nil then v = 0 end
for i = 1,m do
array[i] = v
end
return array
end
--Public Vars and Server initialization
if RandomSpawns == 0 then
parse("mp_randomspawn 0")
else
parse("mp_randomspawn 1")
end
parse("mp_wpndmg knife 0") -- No leftclicking with knife
parse("sv_gamemode 1") -- Gamemode 1 = Deathmatch
parse("mp_wpndmg_z1 knife 100") -- Knife Rightclick Instakill
parse("mp_wpndmg deagle 100") -- Deagle Instakill
TitlePos = "260 40"
AuthorPos = "270 55"
LivesPos = "5 140"
BulletsPos = "5 155"
CurrentWinnerPos = "5 170"
KnifeWarningPos = "5 185"
KnifeWarning2Pos = "5 200"
YouAreDeadPos = "5 215"
Kills = Array(game("sv_maxplayers"),0)
Lives = Array(game("sv_maxplayers"),3)
Bullets = Array(game("sv_maxplayers"),StartingBullets)
Dead = Array(game("sv_maxplayers"),0)
function hudtxt2(id,hid,text,text2,pos)
parse('hudtxt2 '..id..' '..hid..' "'..text..text2..'" '..pos)
end
function ParseLives(id)
hudtxt2(id,3,"©000255000Lives: ",Lives[id],LivesPos)
end
function ParseBullets(id)
hudtxt2(id,4,"©000255000Bullets: ",Bullets[id],BulletsPos)
end
function ParseWinningPlayer(id)
hudtxt2(id,8,"©000255000Winning player: ",player(Winner,"name"),CurrentWinnerPos)
end
function RefreshWinner()
Winner = 0
WinnerKills = -1
for i = 1, game("sv_maxplayers") do
if Kills[i] > WinnerKills and player(i,"exists") then
Winner = i
WinnerKills = Kills[i]
end
i = i + 1
end
for id = 1, game("sv_maxplayers") do
if player(id,"exists") then
if Winner == id then
ParseWinningPlayer(id)
else
ParseWinningPlayer(id)
end
end
id = id + 1
end
end
addhook("join","OnJoin")
function OnJoin(id)
Lives[id] = 3
Bullets[id] = 1
hudtxt2(id,1,"©000255000One in the Champer","",TitlePos)
hudtxt2(id,2,"©000255000By: Anders4000","",AuthorPos)
ParseLives(id)
ParseBullets(id)
hudtxt2(id,5,"©255255000Only rightclicking","",KnifeWarningPos)
hudtxt2(id,6,"©255255000with knife can kill.","",KnifeWarning2Pos)
end
function AutoSpec(id)
parse("makespec "..id)
hudtxt2(id,7,"©255000000You are dead.","",YouAreDeadPos)
end
addhook("spawn","OnSpawn") --Spawnhook.
function OnSpawn(id)
if Lives[id] > 0 then
RefreshWinner()
Bullets[id] = 1
parse("equip "..id.." 3") --iid 3 = Deagle
if player(id,"team") == 2 then --2 = CT
parse("strip "..id.." 1") --1 = USP
elseif player(id,"team") == 1 then --1 = T
parse("strip "..id.." 2") --2 = Glock
end
parse("setweapon "..id.." 3")
ParseLives(id)
ParseBullets(id)
else
parse("makespec "..id)
end
end
addhook("buy","OnBuy")
function OnBuy(id)
return 1
end
addhook("attack","OnAttack")
function OnAttack(id)
if player(id,"weapontype") == 3 then --iid 3 = deagle
Bullets[id] = Bullets[id] - 1
if Bullets[id] < 1 then
parse("strip "..id.." 3") --iid 3 = deagle
parse("setweapon "..id.." 50") --iid 50 = knife
end
end
ParseBullets(id)
end
addhook("kill","OnKill")
function OnKill(killer,victim,weapon)
RefreshWinner()
Kills[killer] = Kills[killer] + 1
Bullets[killer] = Bullets[killer] + 1
parse("equip "..killer.." 3")
parse("setweapon "..killer.." 3")
ParseBullets(killer)
--NextMap?
PlayersAlive = 0
for i = 1, game("sv_maxplayers"), 1 do
if player(i,"exists") then
if Lives[i] > 0 then
PlayersAlive = PlayersAlive + 1
end
end
end
if PlayersAlive < 2 then
NextMap()
end
end
addhook("drop","OnDrop")
function OnDrop()
return 1
end
addhook("die","OnDeath")
function OnDeath(victim)
Lives[victim] = Lives[victim] - 1
ParseLives(victim)
end
addhook("team","OnTeam")
function OnTeam(id,team)
if Lives[id] < 1 then
return 1
end
end
function ParseWinners()
--Parse the winners... <------------------------------------------------------------------------------------ WORK TO DO!
end
function NextMap()
if NextMapType == 2 then
ParseWinners()
--Fine the current map in the array Maps, and then execute the next map. <---------------------------------- WORK TO DO!
else
ParseWinners()
--Wait 15 sec. <-------------------------------------------------------------------------------------------- WORK TO DO!
parse("sv_map "..map("name"))
end
end