All pastes #150386 Raw Edit

Untitled

public lua v1 · immutable
#150386 ·published 2006-08-26 21:05 UTC
rendered paste body
--- [[[ Zombie Zone Script ]]] ------ [[ Map Of User Stats ]] ----- 0 - Zombie kills - The amount of zombies that the player has killed as a marine-- 1 - Marine kills - The amount of marines player has killed as a zombie-- 2 - Zombie Deaths - The amount of deaths that the player has suffered as a zombie-- 3 - Ammo Used - The amount of ammo the player has used up-- 4 - Teamkills - The amount of teamkills the marine has 'achieved' :)-- 5 - Corsplosions - The amount of corpses the zombie has nuked-- 6 - Medicated - How many medikits has the marine had?-- 7 - Ammo Scavenged - How much ammo has the marine scavenged?-- 8 - Resurrections - How many resurrections has the player made?-- 9 - Picked? - Has the marine already been picked for a group?--- [[ Constants ]] ------gc_startingammo = 250	-- The amount of ammo the marine starts withgc_mapcenterx = 5024	-- The center of the map along the x axisgc_mapcentery = 2272	-- The center of the map along the y axis--- [[ Globals ]] --------g_arena = nil		-- The global arena class, to avoid having to pass it around functionsg_bGameRunning = false	-- Is the game running?g_winner = nil		-- The player who wong_winnerevent = 0	-- The eventid for the repeating winner eventg_supplyevent = 0	-- The eventid for dropping suppliesg_roundnum = 0		-- The round we are currently on (Defined by supply drops)g_groupsize = 0		-- The amount of people per marine group--- [[ Other Functions ]] ----- SupplySpawn = For creating a supply drop at a random location on the mapfunction SupplySpawn(ev)	-- Get a hold on the marines team	local marineteam = team_fromname(g_arena, "Marines")	if (marineteam:exists() == false) then		-- Forget it		return	end	-- Increase the round	g_roundnum = g_roundnum + 1	-- Calculate the random coordinates to spawn the supplies	local randx = gc_mapcenterx + math.random(-gc_mapcenterx, gc_mapcenterx)	local randy = gc_mapcentery + math.random(-gc_mapcentery, gc_mapcentery)	-- Create some ammo based on how many marines are left	local ammoamount = (marineteam:num() + 1) * gc_startingammo	-- Spawn it at the location	g_arena:item_create("Ammo", ammoamount, randx, randy)	-- Create a medikit for each marine	local medikitamount = marineteam:num()	g_arena:item_create("Medikit", medikitamount, randx + 50, randy)	-- Give 'em a plasma turret and some walls too	g_arena:item_create("Plasma Turret Kit", 1, randx + 100, randy)	g_arena:item_create("Wall Kit", 10, randx + 150, randy)		-- Convert the coordinates	local lettercoord = "A"	randx = math.floor((randx / 80) / 16)	randy = ((randy / 80) / 16) + 1	if (randx == 0) then		lettercoord = "A"	elseif (randx == 1) then		lettercoord = "B"	elseif (randx == 2) then		lettercoord = "C"	elseif (randx == 3) then 		lettercoord = "D"	elseif (randx == 4) then		lettercoord = "E"	else		lettercoord = "F"	end	-- Inform the players	g_arena:message("!There has been a supply drop at " .. lettercoord .. math.floor(randy) .. "!")end-- SetupEngineer = Give the engineer his suppliesfunction SetupEngineer(engy)	-- Determine the type of items he should have	local turrettype = "Plasma Turret Kit"	local walltype = "Wall Kit"	-- If he has the Skilled Constructor skill	if (engy:skill_find(45) == true) then		-- Upgrade his stuff		turrettype = "Improved Plasma Turret Kit"		walltype = "Enhanced Wall Kit"	end	-- Give him a few turrets to place	engy:inventory_modify(turrettype, 2)			-- If he's got the Agoraphobic skill, give him a few extra walls	local Agoraphobic = 0	if (engy:skill_find(40) == true) then		Agoraphobic = 10	end	engy:inventory_modify(walltype, 10 + Agoraphobic)end-- ChooseZombie = For randomly choosing a zombie type function ChooseZombie(zombie)	-- We want to randomly choose a zombie type to use	local rand = math.random(1, 100)	if (rand < 32) then		zombie:setVehicle(100)	-- Normal Zombie	elseif (rand < 54) then		zombie:setVehicle(103)	-- Alien Zombie	elseif (rand < 75) then		zombie:setVehicle(102)	-- Flesh Zombie	elseif (rand < 87) then		zombie:setVehicle(101)	-- Assassin Zombie	elseif (rand < 95) then		zombie:setVehicle(105)  -- Devourer Zombie	else		-- Tell arena! Tough zombie		g_arena:message(zombie.m_name .. " has spawned as a super-zombie!")		zombie:setVehicle(104)	-- Tough Zombie	end		end-- ChooseMarine = Sets the appropriate class for the marinefunction ChooseMarine(marine)	-- Differ our actions depending on what class the marine is	-- Remove any engineer items and reset their ammo	marine:inventory_modify("Improved Plasma Turret Kit", -1000)	marine:inventory_modify("Enhanced Wall Kit", -1000)	marine:inventory_modify("Plasma Turret Kit", -1000)	marine:inventory_modify("Wall Kit", -1000)	marine:inventory_modify("Laboratory Kit", -1000)	marine:inventory_modify("Ammo", -30000)	marine:inventory_modify("Ammo", gc_startingammo)	marine:inventory_modify("Medikit", -30000)	marine:inventory_modify("Zombie Parts", -30000)	marine:inventory_modify("Marine Parts", -30000)	-- If he's sensible, give him his kit	if (marine:skill_find(44) == true) then		marine:inventory_modify("Medikit", 1)	end	-- Find out how experienced he is	local vehicletype = 10	if (marine:skill_find(13) == true) then		vehicletype = 13	elseif (marine:skill_find(12) == true) then		vehicletype = 12	elseif (marine:skill_find(11) == true) then		vehicletype = 11	end	-- Make him a marine	marine:team_change("Marines", "")	marine:setVehicle(vehicletype)end-- Fireworks = For creating celebration explosions around the player :Dfunction Fireworks(eventid)	-- Create an explosion randomly around the player	local c = g_winner:coords()	g_arena:explosion_create("GG Explode", c.x + math.random(-60, 60), c.y + math.random(-60, 60), c.rotation)end-- ReportStats = For reporting the end-game statisticsfunction ReportStats()	-- Gather and report statistics		if (g_winner == nil) then 		if (g_winner:valid() == true) then			g_arena:message("!Victory: " .. g_winner.m_name)		else 			g_arena:message("!Victory: Nobody!")		end	else		g_arena:message("!Victory: Nobody!")	end	-- Award local variables	local stubplayer = g_arena:get(1)	-- Grab the first player for initial comparisons	if (stubplayer:spectator() == true) then		-- If he's in spec, we don't want him to win anything		for x = 0, 6 do			stubplayer:setstat(x, 0)		end			else	-- Calculate the player's ammo/medication used		stubplayer:setstat(3, stubplayer:getstat(3) - stubplayer:inventory_find("Ammo"))		stubplayer:setstat(6, stubplayer:getstat(6) - stubplayer:inventory_find("Medikit"))	end	local awd_zombiekills = stubplayer	local awd_marinekills = stubplayer	local awd_zombiedeaths = stubplayer	local awd_ammoused = stubplayer	local awd_teamkills = stubplayer	local awd_corsplosions = stubplayer	local awd_medicated = stubplayer	local awd_resurrect = stubplayer	-- Iterate through players and report personal statistics	for x = 2, g_arena:num() do		local plyr = g_arena:get(x)		-- Only take into account players that aren't spectating		if (plyr:spectator() == false) then			-- Compare zombie kills			if (plyr:getstat(0) > awd_zombiekills:getstat(0)) then				awd_zombiekills = plyr			end			-- Compare marine kills			if (plyr:getstat(1) > awd_marinekills:getstat(1)) then				awd_marinekills = plyr			end			-- Compare zombie deaths			if (plyr:getstat(2) > awd_zombiedeaths:getstat(2)) then				awd_zombiedeaths = plyr			end			-- Calculate ammo used			plyr:setstat(3, plyr:getstat(3) - plyr:inventory_find("Ammo"))			if (plyr:getstat(3) > awd_ammoused:getstat(3)) then				awd_ammoused = plyr			end			-- Compare teamkills			if (plyr:getstat(4) > awd_teamkills:getstat(4)) then				awd_teamkills = plyr			end			-- Compare corsplosions! :D			if (plyr:getstat(5) > awd_corsplosions:getstat(5)) then				awd_corsplosions = plyr			end			-- Calculate/Compare medication			plyr:setstat(6, plyr:getstat(6) - plyr:inventory_find("Medikit"))			if (plyr:getstat(6) > awd_corsplosions:getstat(6)) then				awd_medicated = plyr			end			-- Compare players resurrected			if (plyr:getstat(8) > awd_resurrect:getstat(8)) then				awd_resurrect = plyr			end			-- Show player his personal stats			plyr:message("@PERSONAL STATS: Zombie Kills=" .. plyr:getstat(0) .. " Marine Kills=" .. plyr:getstat(1) .. " Zombie Deaths=" .. plyr:getstat(2))			plyr:message("@PERSONAL STATS: Ammo Spent=" .. plyr:getstat(3) .. " Teamkills=" .. plyr:getstat(4) .. " Corsplosions!=" .. plyr:getstat(5))			plyr:message("@PERSONAL STATS: Medication Used=" .. plyr:getstat(6))			--plyr:message("@PERSONAL REWARD: Points=0 Cash=0 Experience=0") <- Fix this!		end	end	-- Then report the awards	g_arena:message("~Most Zombie Kills (" .. awd_zombiekills:getstat(0) .. "): " .. awd_zombiekills.m_name)	g_arena:message("~Most Marine Kills (" .. awd_marinekills:getstat(1) .. "): " .. awd_marinekills.m_name)	g_arena:message("~Most Suicidal Zombie (" .. awd_zombiedeaths:getstat(2) .. "): " .. awd_zombiedeaths.m_name)	g_arena:message("~Most Trigger Happy (" .. awd_ammoused:getstat(3) .. "): " .. awd_ammoused.m_name)	g_arena:message("~Most Teamkills (" .. awd_teamkills:getstat(4) .. "): " .. awd_teamkills.m_name)	g_arena:message("~Most Corsplosions (" .. awd_corsplosions:getstat(5) .. "): " .. awd_corsplosions.m_name)	g_arena:message("~Most Medicated Marine (" .. awd_medicated:getstat(6) .. "): " .. awd_medicated.m_name)	g_arena:message("~Most Resurrections (" .. awd_medicated:getstat(8) .. "): " .. awd_resurrect.m_name)end---------------------------------------------------------------------------------------------------------------------------------------------------------------------- [[ Event Functions ]] -----------------------------------------------------------------------------------------------function Laboratory_Produce(lab, chemist, menuitem)	-- Action taken differs on what the player is trying to do	-- Scavenge Ammo = Attempts to create some ammo	if (menuitem == 0) then		-- Check if he's waited long enough to create more ammo		if (chemist:getstat(7) >= g_roundnum) then			chemist:message("You look around, but don't see any spare parts available.")			return false		end		-- Increase his 'attempt' count		chemist:setstat(7, chemist:getstat(7) + 1)		-- He may randomly fail		if (math.random(0, 100) > 70) then			chemist:message("Due to your inept handling you fail to create ammo and mess up the spare parts.")			return false		else			-- Give the guy some ammo			chemist:message("You have successfully created some ammo!")			chemist:inventory_modify("Ammo", 25)			return false		end			end	return trueendfunction Vehicle_OnProduce(producer, user, menuitem)	-- Divert to the appropriate function depending on what's producing	-- Laboratory?	if (producer:vehicletypeid() == 400) then		local retval = Laboratory_Produce(producer, user, menuitem)		return retval	end	return trueendfunction Vehicle_OnDeath(victim, killer, itemid)	-- Check if the dead vehicle is a corpse	if (victim:vehicletypeid() == 300) then		-- Reward the killer with a corsplosion!		if (killer:valid() == true) then			killer:setstat(5, killer:getstat(5) + 1)		end		-- Check if the itemid is the ressurection item		if (itemid == 2016) then			-- We get to resurrect the player! :)			-- Attempt to find the player that the corpse references			local repplayer = victim:getvar("Represents")			local deadplayer = g_arena:getPlayer(repplayer)			local oldvehicle = victim:getvarint("OldVehicle")			-- Check to see if he exists			if (deadplayer:valid() == false) then				-- If he doesn't, give the chemist his kit back				killer:inventory_modify("Resurrection Kit", 1)					-- Tell him				killer:message("The corpse has degraded too far to be revived.")				killer:message("You gather your kit back and move on.")			else				-- Change him back into a marine!				deadplayer:team_change("Marines", "")				deadplayer:setVehicle(oldvehicle)				-- warp him to the corpse's location				local corpseloc = victim:coords()				deadplayer:warp(corpseloc.x, corpseloc.y, 0)				-- Notify him				deadplayer:message("&You have been revived by " .. killer.m_name .. "!")								-- Give the player a resurrection stat				killer:setstat(9, killer:getstat(9) + 1)			end					end	endendfunction Item_OnPickUp(looter, loot, loot_type, amounttopickup)	-- If he picked up an engineer kit	if (loot_type.m_name == "Engineer Kit") then		-- Player needs to be a marine, and only picking up one kit		if (amounttopickup > 1) then			looter:message("You are only allowed one engineer kit.")			return false		elseif (looter:getVehicle():vehicletypeid() >= 15) then			looter:message("You need to be a marine to become an engineer.")			return false		end		-- Find out how experienced he is		local vehicletype = 15		if (looter:skill_find(13) == true) then			vehicletype = 18		elseif (looter:skill_find(12) == true) then			vehicletype = 17		elseif (looter:skill_find(11) == true) then			vehicletype = 16		end				-- Otherwise, we want to make him an engineer. :)		looter:setVehicle(vehicletype)		-- Gear him up		SetupEngineer(looter)		-- Now we want to destroy the item		local itmstruct = loot:get_struct()		if (itmstruct.amount == 1) then			loot:destroy()		else			itmstruct.amount = itmstruct.amount - 1			loot:update()		end		return false	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Heavy Marine Kit") then		-- Player needs to be a marine, and only picking up one kit		if (amounttopickup > 1) then			looter:message("You are only allowed one heavy marine kit.")			return false		elseif (looter:getVehicle():vehicletypeid() >= 15) then			looter:message("You need to be a marine to become a heavy marine.")			return false		end				-- Find out how experienced he is		local vehicletype = 20		if (looter:skill_find(13) == true) then			vehicletype = 23		elseif (looter:skill_find(12) == true) then			vehicletype = 22		elseif (looter:skill_find(11) == true) then			vehicletype = 21		end		-- Otherwise, we want to make him a heavy. :)		looter:setVehicle(vehicletype)		-- Now we want to destroy the item		local itmstruct = loot:get_struct()		if (itmstruct.amount == 1) then			loot:destroy()		else			itmstruct.amount = itmstruct.amount - 1			loot:update()		end		return false	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Chemist Kit") then		-- Player needs to be a marine, and only picking up one kit		if (amounttopickup > 1) then			looter:message("You are only allowed one chemist kit.")			return false		elseif (looter:getVehicle():vehicletypeid() >= 15) then			looter:message("You need to be a marine to become a chemist.")			return false		end				-- Give him a laboratory kit		looter:inventory_modify("Laboratory Kit", 1)		-- How prepared is he?		if (looter:skill_find(48) == true) then			-- Give him a marine part			looter:inventory_modify("Marine Parts", 1)		end				if (looter:skill_find(47) == true) then			-- Give him some zombie parts			looter:inventory_modify("Zombie Parts", 3)		end		-- Is he a lifesaver?		if (looter:skill_find(49) == true) then			-- Give him a resurrection kit			looter:inventory_modify("Resurrection Kit", 1)		end		-- Find out how experienced he is		local vehicletype = 25		if (looter:skill_find(13) == true) then			vehicletype = 28		elseif (looter:skill_find(12) == true) then			vehicletype = 27		elseif (looter:skill_find(11) == true) then			vehicletype = 26		end		-- Otherwise, we want to make him a chemist. :)		looter:setVehicle(vehicletype)		-- Now we want to destroy the item		local itmstruct = loot:get_struct()		if (itmstruct.amount == 1) then			loot:destroy()		else			itmstruct.amount = itmstruct.amount - 1			loot:update()		end		return false	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Ammo") then		-- Don't let zombies pick up ammo		if (looter:getVehicle():vehicletypeid() >= 100) then			looter:message("Zombies have no use for ammo.")			return false		end		-- Add to the player's ammo count		looter:setstat(3, looter:getstat(3) + amounttopickup)	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Medikit") then		-- Don't let zombies pick up medikits		if (looter:getVehicle():vehicletypeid() >= 100) then			looter:message("Thief. That's for the marines.")			return false		end		-- Has the player had enough medication for now?		if (looter:getstat(6) < g_roundnum + 1) then			-- Give this man his kit!			-- .. if he's not being greedy			if (amounttopickup > 1) then				-- Tell him and refuse the request				looter:message("You can only grab one medikit at a time.")				return false			end				-- Increase his medication			looter:setstat(6, looter:getstat(6) + 1)			return true		else			-- He's not allowed anymore until the next supply drop			looter:message("You've had your medication for this drop!")			return false		end	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Plasma Turret Kit") or (loot_type.m_name == "Wall Kit") then		-- Check to see if he's an engineer		local vehicletypeid = looter:getVehicle():vehicletypeid()		if (vehicletypeid < 15) or (vehicletypeid > 18) then			looter:message("You can't use that.")			return false		end	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Improved Plasma Turret Kit") or (loot_type.m_name == "Enhanced Wall Kit") then		-- Check to see if he's an engineer		local vehicletypeid = looter:getVehicle():vehicletypeid()		if (vehicletypeid < 15) or (vehicletypeid > 18) then			looter:message("You can't use that.")			return false		end	-----------------------------------------------------------------------------------	elseif (loot_type.m_name == "Zombie Parts") or (loot_type.m_name == "Marine Parts") then		local vehicletypeid = looter:getVehicle():vehicletypeid()		if (vehicletypeid < 25) or (vehicletypeid > 28) then			looter:message("You should leave these for chemists.")			return false		end	end	return trueendfunction Arena_OnCreate(arena)	-- Set our global value	g_arena = arena	-- Initialize random	math.randomseed(os.time())endfunction Arena_OnGameStart()	-- Destroy the celebration event	event_destroy(g_winnerevent)	-- Set the supply event in motion	g_supplyevent = event_create(SupplySpawn, -90000, g_arena)	-- Every 1.5 minutes	-- Set variables	g_bGameRunning = true	g_roundnum = 0	-- Turn everyone into marines	for x = 1, g_arena:num() do		local marine = g_arena:get(x)		-- If they're not in spec		if marine:spectator() == false then			-- Set him up			ChooseMarine(marine)		end	end	-- Perform some calculations for the type of game we want	local arenaplaying = g_arena:numplaying()	local amount = math.floor(math.max((arenaplaying / 5), 1))	-- First, search for professional zombies	for x = 1, g_arena:num() do		local marine = g_arena:get(x)		-- Reset their stats while we're walking through the playerlist		marine:setstat(0, 0)		marine:setstat(1, 0)		marine:setstat(2, 0)		marine:setstat(3, gc_startingammo)		marine:setstat(4, 0)		marine:setstat(5, 0)		marine:setstat(6, 0)	-- Start off with 0 medikits		marine:setstat(7, 0)		marine:setstat(8, 0)		marine:setstat(9, 0)		-- Are they a Professional Zombie? (And not in spec)		if (marine:skill_find(200) == true) and (marine:spectator() == false) then			-- Turn him!			marine:team_change("Zombie Horde", "")			ChooseZombie(marine)			-- Warp zombies anywhere			marine:warp(gc_mapcenterx, gc_mapcentery, gc_mapcentery*2)			-- Decrease the number of zombies we need			amount = amount - 1			-- Check to see if we have enough			if (amount <= 0) then				break			end		end	end	-- Locate the player ids which we will turn to zombies	local numplayers = g_arena:num()	for x = 1, amount do		local zombie = g_arena:get(math.random(1, numplayers))				-- If he's not in spec and not already a zombie		if (zombie:spectator() == false) and (zombie:getVehicle():vehicletypeid() < 100) then			-- Turn him			zombie:team_change("Zombie Horde", "")			ChooseZombie(zombie)			-- Warp zombies anywhere			zombie:warp(gc_mapcenterx, gc_mapcentery, gc_mapcentery*2)		else			-- We'll have to try again			x = x - 1		end	end	-- Start putting together the marine team	local marineteam = team_fromname(g_arena, "Marines")		if (marineteam:exists() == false) then		return	end	-- Calculate how many groups we want	local marinesinplay = marineteam:numplaying()	if (marinesinplay < 5) then		g_arena:message("&Not enough players (6) to commence a full game.");		return	end	g_groupsize = 5	local numgroups = math.floor(marinesinplay / g_groupsize)	local leftover = math.mod(marinesinplay, numgroups)	local leftOversPerGroup = math.floor(leftover / numgroups)	-- Start creating the groups..	for x = 1, numgroups do		-- Pick x random marines to add to the group		local teammarines = {}		local teamsize = 0		for i = 1, g_groupsize do			-- Randomly pick a marine			local marine = marineteam:get(math.random(1, marineteam:num()))			-- If he's in spec or already picked, we'll have to try picking again			if (marine:spectator() == true) or (marine:getstat(9) ~= 0) then				-- We'll have to try again				i = i - 1			else				-- Otherwise, he'll do. Add him to the array				teammarines[i] = marine				teamsize = teamsize + 1				-- Flag him as picked				marine:setstat(9, 1)			end		end		-- Deal with the leftover players		for n = 1, leftOversPerGroup do			-- Randomly pick a marine			local marine = marineteam:get(math.random(1, marineteam:num()))			-- If he's in spec or already picked, we'll have to try picking again			if (marine:spectator() == true) or (marine:getstat(9) ~= 0) then				-- We'll have to try again				i = i - 1			else				-- Otherwise, he'll do. Add him to the array				teammarines[teamsize + 1] = marine				teamsize = teamsize + 1				-- Flag him as picked				marine:setstat(9, 1)			end		end				-- If this is the last group to be created..		if (x == numgroups) then			-- We want to make sure that no leftovers are left			for x = 1, g_arena:num() do				local marine = g_arena:get(x)				-- If he is an eligible leftover..				if (marine:spectator() == true) and (marine:getstat(9) == 0) then					-- Add him to the list too					teammarines[teamsize + 1] = marine					teamsize = teamsize + 1				end			end		end			-- Calculate the random coordinates to spawn the marine group		local randx = gc_mapcenterx + math.random(-gc_mapcenterx, gc_mapcenterx)		local randy = gc_mapcentery + math.random(-gc_mapcentery, gc_mapcentery)		-- Spawn the marines		local t = 1				while teammarines[t] do			-- Set him up			ChooseMarine(teammarines[t])						-- Warp them all to the starting point			teammarines[t]:warp(randx, randy, 200)			t = t + 1		end		-- Now that the group is sorted, spawn their gear		-- Create the initial defensive turret		g_arena:vehicle_create(200, randx, randy, 0)		-- Give them some kits		-- Spawn a heavy marine kit for newbies to play with		local itemrandx = math.random(-150, 150)		local itemrandy = math.random(-150, 150)		g_arena:item_create("Heavy Marine Kit", 1, randx + itemrandx, randy + itemrandy)		-- .. and a chemist kit		itemrandx = math.random(-150, 150)		itemrandy = math.random(-150, 150)		g_arena:item_create("Chemist Kit", 1, randx + itemrandx, randy + itemrandy)		-- .. and an engineer kit		itemrandx = math.random(-150, 150)		itemrandy = math.random(-150, 150)		g_arena:item_create("Engineer Kit", 1, randx + itemrandx, randy + itemrandy)	endend	function Arena_OnGameEnd()	-- Kill the supply event	event_destroy(g_supplyevent)	-- Tell people to join the arena	g_arena:message("Game is about to start... enter the game now to play.")	g_bGameRunning = false	-- Show endgame stats	ReportStats()endfunction Player_OnDeath(killer, victim)	-- If the game isn't running, we don't want to do any of the other dynamics	if g_bGameRunning == false then		return	end	-- Check if the victim is a marine	(isn't a zombie)	if (victim:getVehicle():vehicletypeid() < 30) then		-- Has there been a teamkill!?		if (killer:getVehicle():vehicletypeid() < 30) then			-- The killer is a marine too! Teamkill!			killer:setstat(4, killer:getstat(4) + 1)		elseif (killer:getVehicle():vehicletypeid() >= 100) then			-- Otherwise, the killer is a zombie and we need to up his marine kills			killer:setstat(1, killer:getstat(1) + 1)		end		-- First, we'll stick a corpse on top of him		local pos = victim:coords()		local corpse = g_arena:vehicle_create(300, pos.x, pos.y, pos.rotation)		-- Issue details to the corpse		corpse:setvar("Represents", victim.m_name)		corpse:setvarint("OldVehicle", victim:getVehicle():vehicletypeid())				-- .. and marine parts		g_arena:item_create("Marine Parts", 1, pos.x, pos.y)			-- If he has the Bloody Mess skill make him explode		if (victim:skill_find(41) == true) then			g_arena:explosion_create("Super Body Explosion (M)", victim:coords().x, victim:coords().y, 0)		end		-- Remove any engineer items		victim:inventory_modify("Plasma Turret Kit", -1000)		victim:inventory_modify("Wall Kit", -1000)		-- We want to turn the player into a zombie		victim:team_change("Zombie Horde", "")		ChooseZombie(victim)			-- Give him his crown back		victim:setcrown(true, 0)		-- Are we down to one marine yet?		local marineteam = team_fromname(g_arena, "Marines")				if (marineteam:exists() == true) then			-- Look to see how many players are actually left playing			local nummarines = 0			local winner= nil			for x = 1, marineteam:num() do				if marineteam:get(x):spectator() == false then					nummarines = nummarines + 1					winner = marineteam:get(x)				end			end			-- If there is only one surviving marine			if (nummarines == 1) then				-- Take the victim's crown away again				victim:setcrown(false, 0)				-- Break the news!				g_winner = winner				g_arena:message(winner.m_name .. " was the last marine standing! Celebrate!")				-- Let him celebrate :)				winner:setVehicle(50)				g_winnerevent = event_create(Fireworks, -750, g_arena)				local zombieteam = team_fromname(g_arena, "Zombie Horde")				-- Take the crowns from all the zombies				if (zombieteam:exists() == true) then					for x = 1, zombieteam:num() do						local zombie = zombieteam:get(x)						zombie:setcrown(false, 0)						-- Also, if they're a party animal let them celebrate too :)						if (zombie:skill_find(201) == true) then							zombie:team_change("Marines", "")							zombie:setVehicle(51)	-- Animal vehicle						end					end				end							end		end	-- If the victim is a zombie	elseif (victim:getVehicle():vehicletypeid() >= 100) then		-- Give him his crown back		victim:setcrown(true, 0)		-- Make him a random class		ChooseZombie(victim)		-- Add one to his zombie deaths		victim:setstat(2, victim:getstat(2) + 1)		-- Spawn some zombie parts on his death-bed		local pos = victim:coords()		g_arena:item_create("Zombie Parts", 1, pos.x, pos.y)			-- If the killer is a marine..		if (killer:getVehicle():vehicletypeid() < 15) then			-- Get his zombie kills			local zombiekills = killer:getstat(0)			local zombievehicle = killer:getVehicle():vehicletypeid()			zombiekills = zombiekills + 1			-- Is he ready for an upgrade?			if (zombiekills == 2) and (zombievehicle == 10) then				killer:setVehicle(11)			elseif (zombiekills == 4) and (zombievehicle == 11) then				killer:setVehicle(12)			elseif (zombiekills == 6) and (Zombievehicle == 12) then				killer:setVehicle(13)			end			killer:setstat(0, zombiekills)		-- .. an engineer?		elseif (killer:getVehicle():vehicletypeid() < 20) then			-- Get his zombie kills			local zombiekills = killer:getstat(0)			local zombievehicle = killer:getVehicle():vehicletypeid()			zombiekills = zombiekills + 1			-- Is he ready for an upgrade?			if (zombiekills == 2) and (zombievehicle == 15) then				killer:setVehicle(16)			elseif (zombiekills == 4) and (zombievehicle == 16) then				killer:setVehicle(17)			elseif (zombiekills == 6) and (Zombievehicle == 17) then				killer:setVehicle(18)			end			killer:setstat(0, zombiekills)		-- .. a heavy?		elseif (killer:getVehicle():vehicletypeid() < 25) then			-- Get his zombie kills			local zombiekills = killer:getstat(0)			local zombievehicle = killer:getVehicle():vehicletypeid()			zombiekills = zombiekills + 1			-- Is he ready for an upgrade?			if (zombiekills == 2) and (zombievehicle == 20) then				killer:setVehicle(21)			elseif (zombiekills == 4) and (zombievehicle == 21) then				killer:setVehicle(22)			elseif (zombiekills == 6) and (Zombievehicle == 22) then				killer:setVehicle(23)			end			killer:setstat(0, zombiekills)		-- .. a chemist?		elseif (killer:getVehicle():vehicletypeid() < 30) then			-- Get his zombie kills			local zombiekills = killer:getstat(0)			local zombievehicle = killer:getVehicle():vehicletypeid()			zombiekills = zombiekills + 1			-- Is he ready for an upgrade?			if (zombiekills == 2) and (zombievehicle == 25) then				killer:setVehicle(26)			elseif (zombiekills == 4) and (zombievehicle == 26) then				killer:setVehicle(27)			elseif (zombiekills == 6) and (Zombievehicle == 27) then				killer:setVehicle(28)			end			killer:setstat(0, zombiekills)		end	endendfunction Player_OnJoin(visitor)	-- Give him information! :)	visitor:message("&Note: This zone is essentially just a test of the server's new scripting capabilities.")endfunction Player_OnUnspec(visitor)	-- Check if the game is in progress	if (g_bGameRunning == true) then		-- Remove any engineer items and reset their ammo		visitor:inventory_modify("Improved Plasma Turret Kit", -1000)		visitor:inventory_modify("Enhanced Wall Kit", -1000)		visitor:inventory_modify("Plasma Turret Kit", -1000)		visitor:inventory_modify("Wall Kit", -1000)		visitor:inventory_modify("Laboratory Kit", -1000)		visitor:inventory_modify("Ammo", -30000)		visitor:inventory_modify("Ammo", gc_startingammo)		visitor:inventory_modify("Medikit", -30000)		visitor:inventory_modify("Zombie Parts", -30000)		visitor:inventory_modify("Marine Parts", -30000)		-- Reset all his stats		visitor:setstat(0, 0)		visitor:setstat(1, 0)		visitor:setstat(2, 0)		visitor:setstat(3, gc_startingammo)		visitor:setstat(4, 0)		visitor:setstat(5, 0)		visitor:setstat(6, 0)		visitor:setstat(7, 0)		-- We want to unspec the player into the zombie team		visitor:unspec("Zombie Horde", "")			ChooseZombie(visitor)		-- Warp him anywhere		visitor:warp(gc_mapcenterx, gc_mapcentery, gc_mapcenterx*2)		-- Tell him why he spawned as a zombie		visitor:message("&The game is already in progress so you have been spawned as a zombie.")				-- Don't allow the typical game logic to take effect		return false	end		-- Process as per normal	return trueend