Public feed #601387

Anonymous

public lua v1 · immutable
Raw Edit
·published 2007-07-03 13:58 UTC
rendered paste body
g_arena = nilg_tfactory = nilg_qfactory = nilg_ttanks = 0g_qtanks = 0g_maketank = { }--Notes-- 4545, 385 Toriad Republic's base coords-- Toiad = 0st frequency-- 319 4723 Toriad Republic's base coords-- Toiad = 1st frequencyfunction Arena_OnCreate(arena)              g_arena = arena   math.randomseed(os.time())      -- Create Toriad Republic's Factoryendfunction Msg_OnCommand(plyr, command, payload, recipient, msg_type) -- player, string, string, string, integer	if (command == "?loc") then		plyr:message("X = " .. plyr:coords().x .. " Y = " .. plyr:coords().y .. " .")	endendfunction Player_OnUnspec(plyr) -- player	-- Get the teams	tori = team_fromID(g_arena, 0)	qloos = team_fromID(g_arena, 1)	-- Assign them to a team		event_createarg(yourSide, -10, g_arena, plyr)		-- Now lets check in the bases have been spawned, if not lets go ahead and respawn them	if (g_tfactory == nil) then -- Toriad Factory doesn't exsist		g_tfactory = g_arena:vehicle_create(402, 4545, 385, 0)		g_tfactory:setFrequency(0)	end		if (g_qfactory == nil) then -- Qloos factory doesn't exist.		g_qfactory = g_arena:vehicle_create(402, 317, 4723, 0)		g_qfactory:setFrequency(1)	endreturn true -- return boolean (whether to allow the player to unspec or not)endfunction yourSide(plyr)	if (plyr:getFrequency() == 1) then		plyr:warp(139, 4712, 10) -- Warp them to Qloos's Team side	else		plyr:warp(4545, 385, 10) -- Warp them to Toriads Team side	end	return trueendfunction Vehicle_OnProduce(vech, plyr, menuitem) -- vehicle, player, integer	local menu = menuitem + 1	local vid = vech:vehicletypeid()	local c = vech:coords()	g_maketank[plyr:getTeam().m_name] = nil			if (vid == 402) then -- They are talking to the tank maker		if (menu == 1) then --they are trying to make a tank			if (plyr:skillFind(1) == true) then -- They are a driver				if (plyr:getFrequency() == 1) then					if (g_qtanks >= 10) then						plyr:message("You have to many tanks on your team already")					else						if (g_maketank[plyr:getTeam().m_name] ~= nil) then							event_destroy(g_arena, g_maketank[plyr:getTeam().m_name])							g_qtanks = g_qtanks -1						end						plyr:message("Please wait while we build your tank (10 seconds)")						g_maketank[plyr:getTeam().m_name] = event_createarg(makeTank, 10000, g_arena, c)						g_qtanks = g_qtanks + 1					end				elseif (plyr:getFrequency() == 0) then					if (g_ttanks >= 10) then						plyr:message("You have to many tanks on your team already")					else						if (g_maketank[plyr:getTeam().m_name] ~= nil) then							event_destroy(g_arena, g_maketank[plyr:getTeam().m_name])							g_ttanks = g_ttanks -1						end						plyr:message("Please wait while we build your tank (10 seconds)")						g_maketank[plyr:getTeam().m_name] = event_createarg(makeTank, 10000, g_arena, c)						g_ttanks = g_ttanks + 1					end				end			else				plyr:message("You are not a driver!")			end		end	endreturn true --return boolean (whether to allow the produce or not)endfunction makeTank(coords)		g_arena:vehicle_create(110, coords.x - 120, coords.y, 0)return trueendfunction Vehicle_OnDeath(vech, plyr, itemid) -- vehicle, player, integer	local vid = vech:vehicletypeid()	if (vid == 110) then		if (vech:getFrequency() == 0) then			g_ttanks = g_ttanks - 1		else			g_qtanks = g_qtanks -1		end	endend