All pastes #931187 Raw Edit

Miscellany

public lua v1 · immutable
·published 2008-03-07 00:35 UTC
rendered paste body
-- This holds all the functions for the player object manipulation.go_player = { }function createNewObject_player(name)	if (name == '') then		return false	end		go_player[name] = { }		--account information	go_player[name]['account'] = { }	go_player[name]['account']['name'] = name	--bindspot information	go_player[name]['bindspot'] = { }	go_player[name]['bindspot']['x'] = 1979	go_player[name]['bindspot']['y'] = 2372	--mark info	go_player[name]['mark'] = { }	go_player[name]['mark']['x'] = 0	go_player[name]['mark']['y'] = 0		--faction information	go_player[name]['faction'] = { }	go_player[name]['faction']['name'] = name	go_player[name]['faction']['rank'] = 'Member'	go_player[name]['faction']['invites'] = { }		--alignment information	go_player[name]['alignment'] = { }	go_player[name]['alignment']['hasPicked'] = 0	go_player[name]['alignment']['name'] = ''		--skills information	go_skills[name] = { }	go_skills[name]['Sprint'] = 0	go_skills[name]['Air Magic'] = 0	go_skills[name]['Earth Magic'] = 0	go_skills[name]['Fire Magic'] = 0	go_skills[name]['Water Magic'] = 0	go_skills[name]['Death Magic'] = 0	go_skills[name]['Life Magic'] = 0	go_skills[name]['Mining'] = 0	go_skills[name]['Jump'] = 0		return trueendfunction loadObject_player(name)	if (name == '' or importTSF(name, 'player') == false) then		return false	end	go_player[name] = { }	go_player[name] = importTSF(name, 'player')		go_skills[name] = { }	go_skills[name] = importTSF(name, 'skills')		return trueendfunction saveObject_player(name)	if (name == '' or exportTSF(go_player[name], name, 'player') == false or exportTSF(go_skills[name], name, 'skills')) then		return false	else		return true	endend--this contains all quests and quest related functionsfunction handleQuests(vehicle, player, menuitem)		local menu = menuitem + 1	local vid = vehicle:vehicletypeid()end--includes everything with marking and recallingfunction castMark(username, x, y)	if (username == '') then		return false	end		go_player[username]['mark']['x'] = x	go_player[username]['mark']['y'] = y	return trueendfunction castRecall(user)	if (user == nil) then		return false	end	if (go_player[user.m_name]['mark']['x'] == 0 and go_player[user.m_name]['mark']['y'] == 0) then		user:message('You have not yet marked a location to recall to.')		return false	end	user:warp(go_player[user.m_name]['mark']['x'],	go_player[user.m_name]['mark']['y'], 0)	return trueend--this will hold all functions for skill related stuff.gt_skills = { }gt_skills['Sprint'] = {1, 2, 3, 4, 5}gt_skills['Earth Magic'] = {6, 7, 8, 9, 10}gt_skills['Air Magic'] = {11, 12, 13, 14, 15}gt_skills['Fire Magic'] = {16, 17, 18, 19, 20}gt_skills['Water Magic'] = {21, 22, 23, 24, 25}gt_skills['Death Magic'] = {26, 27, 28, 29, 30}gt_skills['Life Magic'] = {31, 32, 33, 34, 35}gt_skills['Mining'] = {36, 37, 38, 39, 40}gt_skills['Jump'] = {41, 42, 43, 44, 45}gt_skillLevelRequired = { }gt_skillLevelRequired['Sprint'] = 500gt_skillLevelRequired['Earth Magic'] = 500gt_skillLevelRequired['Air Magic'] = 500gt_skillLevelRequired['Fire Magic'] = 500gt_skillLevelRequired['Water Magic'] = 500gt_skillLevelRequired['Death Magic'] = 500gt_skillLevelRequired['Life Magic'] = 500gt_skillLevelRequired['Mining'] = 500gt_skillLevelRequired['Jump'] = 500go_skills = { }function checkSkill(plyr, skill)	if (gt_skills[skill] == nil or plyr == nil) then		return false	end		local level = 0	for i=1, table.getn(gt_skills[skill]) do		if (plyr:skillFind(gt_skills[skill][i]) == true) then			level = i		end	end	return levelendfunction getSkillLevel(plyr)	local level = 1	local skills = { }	for i=1, 45 do		table.insert(skills, i)	end		for i=1, table.getn(skills) do		if (plyr:skillFind(skills[i]) == true) then			level = level + 1		end	end	return levelendfunction addSkills(plyr)		--check for sprint.	local sprint = checkSkill(plyr, 'Sprint')	if (sprint > 0) then		plyr:inventory_modify('Sprint - Level '.. sprint..'', -500)		plyr:inventory_modify('Sprint - Level '.. sprint..'', 1)	endendfunction levelUp(plyr, skill)		local level = checkSkill(plyr, skill)		if (gt_skills[skill][level + 1] == nil) then		plyr:message('You are already the highest you can be in '..skill)		return false	end		if (level ~= 0) then		plyr:inventory_modify(skill..' - Level '..level..'', -1)		--Sprint - Level 1:Training	end		plyr:inventory_modify(skill..' - Level '..(level + 1)..':Training', 1)	if (skill == 'Sprint' or skill == 'Jump') then		plyr:inventory_modify(skill..' - Level '..(level + 1)..'', 1)	elseif (skill == 'Mining') then		plyr:inventory_modify('Pickaxe - Level '..(level + 1)..'', 1)	end	plyr:message('You have leveled up in '..skill)	return trueendfunction checkSkillIncrease(plyr, skill, percent)	local testing = math.randomseed(os.time())	testing = math.random(0, 100)	testing = math.random(0, 100)	testing = math.random(0, 100)	if (testing <= percent) then		go_skills[plyr.m_name][skill] = go_skills[plyr.m_name][skill] + 1		--plyr:message('You have just increased your skill in '..skill..'. ('..go_skills[plyr.m_name][skill]..'/'..gt_skillLevelRequired[skill]..')')	endendfunction checkSkillLevelUp(plyr, skill)	if (go_skills[plyr.m_name][skill] >= gt_skillLevelRequired[skill]) then		go_skills[plyr.m_name][skill] = 0		levelUp(plyr, skill)	endendfunction checkSkillUsed(plyr, itemid, target)		if (itemid == 5 or itemid == 6 or itemid == 7 or itemid == 8 or itemid == 9) then		local percent = 100 - (100 * checkSkill(plyr, 'Sprint') / table.getn(gt_skills['Sprint']))		checkSkillIncrease(plyr, 'Sprint', percent)		checkSkillLevelUp(plyr, 'Sprint')		return true	end		if (itemid == 65 or itemid == 66 or itemid == 67 or itemid == 68 or itemid == 69) then		local percent = 100 - (100 * checkSkill(plyr, 'Mining') / table.getn(gt_skills['Mining']))		checkSkillIncrease(plyr, 'Mining', percent)		checkSkillLevelUp(plyr, 'Mining')		checkMinerals(plyr)		return false	end		if (itemid == 80 or itemid == 81 or itemid == 82 or itemid == 83 or itemid == 84 ) then		local percent = 100 - (100 * checkSkill(plyr, 'Jump') / table.getn(gt_skills['Jump']))		checkSkillIncrease(plyr, 'Jump', percent)		checkSkillLevelUp(plyr, 'Jump')		local pos = plyr:coords()		g_arena:explosion_create('Jump P Level 1',pos.x,pos.y,pos.z,pos.rotation)		return true	endendfunction checkSkills(plyr, skill)	plyr:message(''..skill..' - '..go_skills[plyr.m_name][skill]..'/'..gt_skillLevelRequired[skill])end--hold all spell stufffunction castWeaken(plyr)	local c = plyr:coords()	local victims = { }	g_arena:GetPlayersInArea(victims, c.x, c.y, 100)		if (victims["n"] > 1) then		for i=1, table.getn(victims) do			if (plyr.m_name ~= victims[i].m_name) then				victims[i]:message('You have been weakened by '..plyr.m_name)				victims[i]:inventory_modify('Effect:Weaken(Victim)', 1)				plyr:message('You have weakened, '..victims[i].m_name)				break			end		end	else		plyr:message('You have weakened no one but yourself.')		plyr:inventory_modify('Effect:Weaken(Caster)', 1)	endendfunction castProtect(plyr)		if (plyr:inventory_find('Effect:Protect') >= 1) then		plyr:inventory_modify('Effect:Protect', -1)	end		plyr:inventory_modify('Effect:Protect', 1)	plyr:message('You feel protected.')endfunction castStrength(plyr)		if (plyr:inventory_find('Effect:Strength') >= 1) then		plyr:inventory_modify('Effect:Strength', -1)	end		plyr:inventory_modify('Effect:Strength', 1)	plyr:message('You feel strengthened.')endfunction checkRuneGain(plyr, runetype)		local percent = 100 - (100 * checkSkill(plyr, runetype..' Magic') / table.getn(gt_skills[runetype..' Magic']))	local testing = math.randomseed(os.time())	testing = math.random(0, 100)	testing = math.random(0, 100)	testing = math.random(0, 100)		if (testing <= percent) then		plyr:inventory_modify(runetype..' Rune', 1)	endendfunction levelUpMagic(plyr, skill)		local level = checkSkill(plyr, skill)		if (gt_skills[skill][level + 1] == nil) then		plyr:message('You are already the highest you can be in '..skill)		return false	end		plyr:inventory_modify(skill..' - Level '..(level + 1)..':Training', 1)		return trueendfunction runeHandIn(plyr, runetype, amount)		if (plyr:inventory_find(runetype..' Rune') < amount) then		plyr:message('You do not have that many Runes')		return false	end	local differ = 0	if (go_skills[plyr.m_name][runetype..' Magic'] + amount > gt_skillLevelRequired[runetype..' Magic']) then		differ = (go_skills[plyr.m_name][runetype..' Magic'] + amount) - gt_skillLevelRequired[runetype..' Magic']	end		go_skills[plyr.m_name][runetype..' Magic'] = go_skills[plyr.m_name][runetype..' Magic'] + amount	plyr:inventory_modify(runetype.. ' Rune', -amount)		if (differ > 0) then		plyr:inventory_modify(runetype..' Rune', differ)	end		checkMagicLevelUp(plyr, runetype)endfunction checkMagicLevelUp(plyr, magictype)	if (go_skills[plyr.m_name][magictype..' Magic'] >= gt_skillLevelRequired[magictype..' Magic']) then		go_skills[plyr.m_name][magictype..' Magic'] = 0		levelUp(plyr, magictype..' Magic')	endendfunction import_data(i, c)	local output = { }	--while (i >= 1 and i <= table.getn(g_input)) do	if (g_input[i] ~= nil) then		if (string.find(g_input[i], '<') ~= nil and string.find(g_input[i], '>') ~= nil and string.find(g_input[i], '/') == nil) then			temp = string.gsub(g_input[i], '<', '')			temp = string.gsub(temp, '>', '')			temp = string.gsub(temp, '/', '')			if (string.find(g_input[i + 1], '<') ~= nil and string.find(g_input[i + 1], '>') ~= nil and string.find(g_input[i + 1], '/') == nil) then				table.insert(output[temp], import_data(i + 1, 'o'))				table.remove(g_input, i + 1)			elseif (string.find(g_input[i + 1], '<') == nil) then				if (tonumber(g_input[i + 1]) ~= nil) then					table.insert(output[temp], tonumber(g_input[i + 1]))				else					table.insert(output[temp], g_input[i + 1])				end			end			table.remove(g_input, i)		elseif (string.find(g_input[i], '/') ~= nil) then			table.remove(g_input, i)			import_data(i, 'c')		end	end	if (c = 'c') then		return	else		return output	endend--Documentation Coming soong_output = { }g_input = { }function exportTSF(data, name, filetype)			local TSF = io.open(''..name..'_'..filetype..'.tsf', "w")		g_output = { }		local exportinfo = format_data(data)		for i=1, table.getn(g_output) do		TSF:write(g_output[i])	end		TSF:close()			return trueendfunction format_data(data)	if(data == nil) then		return	end		if (type(data) ~= 'table') then		table.insert(g_output,table.getn(g_output)+1, ''..data..'')		return	end	for i, v in pairs(data) do		table.insert(g_output, '<'..i..'>\n')		if (type(v) == 'table') then			--it is a table			format_data(v)		else			table.insert(g_output,table.getn(g_output)+1, ''..v..'\n')		end		table.insert(g_output,table.getn(g_output)+1, '</'..i..'>\n')	end		returnendfunction importTSF(name, filetype)		local output = { }		TSF = io.open(''..name..'_'..filetype..'.tsf', 'r')		if (TSF == nil) then		return false	end		local input = { }	local nextline = ''	local numlines = 0	--reads entire file into input array, one line at a time	while nextline ~= nil do		nextline = TSF:read('*line')		if (nextline == nil) then			break		end		numlines = numlines + 1		table.insert(input,nextline)	end		TSF:close()		output = import_data(input)	--table.getn kinda fails for this	--if table.getn(output)==0 then	--	return false	--end		return outputendfunction import_data(input)	local output = { }	--at all times, removes one line from the input array	while true do		if (input[1] ~= nil) then			--if this is a close </html> brace then move back one level in the recursion			if (string.find(input[1], '<') ~= nil and string.find(input[1], '>') ~= nil and string.find(input[1], '/') ~= nil) then				table.remove(input,1)				return output			--if this is an open <html> brace add one level to the recursion			elseif (string.find(input[1], '<') ~= nil and string.find(input[1], '>') ~= nil) then				local temp = string.gsub(input[1], '<', '')				temp = string.gsub(temp, '>', '')				table.remove(input,1)				output[temp] = import_data(input)			else			--if this is just data, put it in the output (when there is output they will never add another recursion level... or another output)				if (tonumber(input[1]) ~= nil) then					output = tonumber(input[1])				else					output = input[1]				end				table.remove(input,1)			end		else			return output	--if no more lines left this is the final output, just return		end	end	return output	--redundantendif (g_arena == nil) then	dofile('TSF.lua')	dofile('playerobject.lua')	dofile('binding.lua')	dofile('recalling.lua')	dofile('factionobject.lua')	dofile('skills.lua')	dofile('spells.lua')	dofile('quests.lua')	dofile('experience.lua')	dofile('mining.lua')	dofile('alignments.lua')	go_player = {}	gb_factionloaded = falseendfunction Arena_OnCreate(arena)	g_arena = arena	math.randomseed(os.time())endfunction Player_OnJoin(plyr) -- player	if (loadObject_player(plyr.m_name) == false) then		plyr:message('Failed to load an existing profile attempting to create a new one.')		if (createNewObject_player(plyr.m_name) == false) then			plyr:message('Failed to create a new profile, please see an admin.')		else			plyr:message('Successfully created a new profile for '.. plyr.m_name)		end	else		plyr:message(plyr.m_name .. ' successfully loaded.')	end	if (gb_factionloaded == false) then		loadObject_faction()		gb_factionloaded = true	end	addSkills(plyr)	isValidFaction(plyr)	checkFactionInvites(plyr)endfunction Player_OnLeave(plyr)	saveObject_player(plyr.m_name)	saveObject_faction()endfunction Item_OnPickUp(player, itemid, item_type, amount) -- player, integer, object?, integer / returns boolean true or false, whether to allow player to pickup the item.		return trueendfunction Player_OnDeath(killer, victim) -- player, player	handleExperienceGain(killer, victim)endfunction Player_OnWarpItem(user, itemid, target) -- player, integer, player / returns boolean true or false, whether to allow the warpitem to complete.	if (itemid == 1) then		if (bindSoul(user.m_name, user:coords().x, user:coords().y) == false) then			user:message('Failed to Bind your soul.')			return false		end		return false	elseif (itemid == 3) then		if (castMark(user.m_name, user:coords().x, user:coords().y) == false) then			user:message('Failed to mark your location.')		end		return false	elseif (itemid == 4) then		if (castRecall(user) == false) then			user:message('Failed to cast recall.')		end		return false	elseif (itemid == 25) then		castWeaken(user)		return false	elseif (itemid == 29) then		--castMagicTrap(user)		return false	elseif (itemid == 30) then		--castMagicTrigger(user)		return false	elseif (itemid == 31) then		castProtect(user)		return false	elseif (itemid == 32) then		castStrength(user)		return false	end			if (checkSkillUsed(user, itemid, target) == false) then		return false	else		return true	end		return trueendfunction Player_OnUnspec(plyr) -- player / Returns boolean true of false, whether to allow player to unspec.	if not (go_player == nil or go_player[plyr.m_name] == nil or go_player[plyr.m_name]['faction'] == nil or go_player[plyr.m_name]['faction']['name'] == nil) then		plyr:unspec(go_player[plyr.m_name]['faction']['name'], 'test')				if (sendToBindSpot(plyr.m_name) == false) then			plyr:message('Failed to send you to least bound spot, please contact an Administrator.')		end		else		return true	end		return falseendfunction Player_OnRespawn(plyr) -- player / Returns boolean true or false, whether to respawn the player.	if (resurrectToBindSpot(plyr.m_name) == false) then		plyr:message('Failed to send you to least bound spot, please contact an Administrator.')	end	return falseendfunction Vehicle_OnProduce(vehicle, player, menuitem) -- vehicle, player, integer / returns boolean true or false and whether to give the player the produce.endfunction Vehicle_OnDeath(vehicle, player, itemid) -- vehicle, player, integerendfunction Msg_OnCommand(plyr, command, payload, recipient, msg_type) -- player, string, string, string, integer	if (plyr:getPermissionLevel() == 3) then		if (command == '?reloadscript') then			plyr:message('Reloading Script')			dofile('unknown.lua')			plyr:message('Script Reloaded')			return		elseif (command == '?loc') then			local c = plyr:coords()			plyr:message('X = '.. c.x .. ' Y = '.. c.y .. ' Rotation = '..c.rotation)			return		elseif (command == '?save') then			if (payload == 'player') then				saveObject_player(plyr.m_name)				plyr:message('Saved '..plyr.m_name)			elseif (payload == 'faction') then				saveObject_faction()				plyr:message('Saved Factions')			end		elseif (command == '?test') then			local c = plyr:coords()			--g_arena:vehicle_create(10, c.x, c.y, c.rotation)			--g_arena:explosion_create('Static Field', c.x, c.y, c.rotation, plyr)			--runeHandIn(plyr, 'Fire', 500)			--local mytable = { }			--local c = plyr:coords()			--g_arena:GetPlayersInArea(mytable, c.x, c.y, 100)			--for i=1, table.getn(mytable) do			--	g_arena:message(''..mytable[i].m_name..'')			--end			--g_arena:message(''..mytable["n"]..'')			local skillLevel = getSkillLevel(plyr)			g_arena:message('Your skill level is '..skillLevel)		elseif (command == "?reloadpl") then			plyr:message('Reloading Quests')			dofile('quests.lua')			plyr:message('Quests Reloaded')		elseif (command == '?r') then			local a=plyr:coords()			g_arena:message(''..a.x..', '..a.y..', '..a.z..', '..a.rotation)		end	end		if (command == '?help') then		if (payload == 'factions') then			plyr:message('%?createfaction <name> -- Creates a Faction with the name provided.')			plyr:message('%?leavefaction -- Leaves current faction, if you are the owner it will disband it.')			plyr:message('%?factionpromote <member> -- Promotes a faction Member to Officer.')			plyr:message('%?factiondemote <member> -- Demotes a faction Member to Member.')			plyr:message('%?factioninvite <newmember> -- Invites a person to join your faction.')			plyr:message('%?acceptinvite <factionname> -- Accepts the invite sent by a faction.')			plyr:message('%?listinvites -- Lists all your current invites.')		elseif (payload == 'skills') then			plyr:message('%?checkskill <skill> -- Displays your current progress towars levelup in the given skill.')		elseif (payload == '') then			plyr:message('@Use this for help ?help <topic>. Topics are')			plyr:message('@factions')			plyr:message('@skills')		end	elseif (command == '?createfaction') then		if (createFaction(plyr, payload) == false) then			plyr:message('Failed to create faction. Reasons may be: invalid name, already an owner, or name taken.')		else			plyr:message('You are now the owner of '..payload)		end	elseif (command == '?factioninvite') then		if (checkRank(plyr) == 'Owner' or checkRank(plyr) == 'Officer') then			if (inviteToFaction(go_player[plyr.m_name]['faction']['name'], payload) == false) then				plyr:message('Could not invite '..payload..' check syntax.')			end		else			plyr:message('You cannot invite people to your faction.')		end	elseif (command == '?acceptinvite') then		if (checkRank(plyr) == 'Owner') then			plyr:message('Owners cannot switch factions.')		else			if (acceptInvite(plyr, payload) == false) then				plyr:message('Could not join '..payload)			else				plyr:message('You are now part of '..payload)			end		end	elseif (command == '?listinvites') then		if (listInvites(plyr) == false) then			plyr:message('You have received no invites')		end	elseif (command == '?leavefaction') then		if (checkRank(plyr) == 'Owner') then			if (disbandFaction(plyr) == false) then				plyr:message('You cannot leave your faction as you are the leader and there are other people in your faction.')			end		else			if (leaveFaction(plyr) == false) then				plyr:message('You cannot leave your faction.')			end		end	elseif (command == '?factionpromote') then		if (plyr ~= nil and g_arena:getPlayer(payload) ~= nil) then			if (checkRank(plyr) == 'Owner' and plyr.m_name ~= payload and checkRank(g_arena:getPlayer(payload)) == 'Officer' and go_player[plyr.m_name]['faction']['name'] == go_player[payload]['faction']['name']) then				if (promoteMember(plyr) == false) then					plyr:message('You failed to promote '..payload..'')				else					plyr:message('Promoted '..payload)				end			else				plyr:message('You cannot promote this person, due to insufficent status or your trying to promote yourself.')			end		end	elseif (command == '?factiondemote') then		if (plyr ~= nil and g_arena:getPlayer(payload) ~= nil) then			if (checkRank(plyr) == 'Owner' and plyr.m_name ~= payload and checkRank(g_arena:getPlayer(payload)) == 'Member' and go_player[plyr.m_name]['faction']['name'] == go_player[payload]['faction']['name']) then				if (demoteMember(plyr) == false) then					plyr:message('You failed to demote '..payload..'')				else					plyr:message('Demoted '..payload)				end			else				plyr:message('You cannot demote this person, due to insufficent status or your trying to demote yourself.')			end		end	elseif (command == '?checkskill') then		if (go_skills[plyr.m_name][payload] ~= nil) then			checkSkills(plyr, payload)		else			plyr:message('Invalid Skill')		end	elseif (command == '?wipecharacter') then		if (g_arena.m_name == 'Public1' and plyr:spectator() == true) then			createNewObject_player(plyr.m_name)		end	endendfunction On_FlagGameEnd()		g_arena:message('test')endfunction getn(awesome)	local numb = { }	for i, v in pairs(awesome) do		table.insert(awesome, i)	end	return numbend--allignment stufffunction getAlignment(plyr)	return go_player[plyr.m_name]['alignment']['name']endfunction setAlignment(plyr, alignment)	if (alignment == 'Suns Confederacy' or alignment == 'The Syndicate' or alignment == 'Titan Coalition') then		go_player[plyr.m_name]['alignment']['name'] = alignment		go_player[plyr.m_name]['alignment']['hasPicked'] = 1	else		plyr:message('Invalid Alignment')	endend--This will hold all lua regards to bindsfunction sendToBindSpot(name)	if (name == '') then		return false	end		local player = g_arena:getPlayer(name)	if not (go_player == nil or go_player[name] == nil or go_player[name]['bindspot'] == nil or tonumber(go_player[name]['bindspot']['x']) == nil or tonumber(go_player[name]['bindspot']['y']) == nil) then		player:warp(tonumber(go_player[name]['bindspot']['x']), tonumber(go_player[name]['bindspot']['y']), 0)	end	return trueendfunction resurrectToBindSpot(name)	if (name == '') then		return false	end		local player = g_arena:getPlayer(name)	if not (go_player == nil or go_player[name] == nil or go_player[name]['bindspot'] == nil or tonumber(go_player[name]['bindspot']['x']) == nil or tonumber(go_player[name]['bindspot']['y']) == nil) then		player:resurrectWarp(tonumber(go_player[name]['bindspot']['x']), tonumber(go_player[name]['bindspot']['y']), 0)		giveGod(player, tonumber(go_player[name]['bindspot']['x']), tonumber(go_player[name]['bindspot']['y']))	end	return trueendfunction giveGod(plyr, x, y)	local c = plyr:coords()		plyr:inventory_modify('God Mode', 1)	g_arena:explosion_create('Anti God', x, y, c.rotation)endfunction bindSoul(name, x, y)	if (name == '') then		return false	end		go_player[name]['bindspot']['x'] = x	go_player[name]['bindspot']['y'] = y		return trueend-- handles all experience related functionsfunction handleExperienceGain(killer, victim)	local xp = 100		--lets find out how many people are in the area of the killer and are on his team.		local killersInArea = getTeamInArea(killer)	local victimsInArea = getTeamInArea(victim)		xp = xp * (victimsInArea/killersInArea)	xp = xp * (getSkillLevel(victim)/getSkillLevel(killer))		killer:message('You have gained '..xp..' exp.')	killer:modExperience(xp)endfunction getTeamInArea(person)		local count = 0	local c = person:coords()	local playertable = { }	g_arena:GetPlayersInArea(playertable, c.x, c.y, 100)		for i=1, table.getn(playertable) do		if (playertable[i].m_name ~= nil) then			local plyr = playertable[i]			if (plyr.m_team == person.m_team) then				count = count + 1			end		end	end	return countend-- contains mining informationglobal_mines = { }	mine1 = { }	mine1['types'] = {'Torium', 'Roxium'}	mine1['box'] = {1467, 565, 2112, 84}	function checkMinerals(plyr)	end--This will contain all FAction info and functions.go_faction = { }function createFaction(owner, name)	if (owner == nil or name == '' or go_faction[name] ~= nil or go_player[owner.m_name]['faction']['rank'] == 'Owner') then		return false	end		go_faction[name] = { }		--information	go_faction[name]['owner'] = owner.m_name	go_faction[name]['membercount'] = 1		--modify the player object for faction	go_player[owner.m_name]['faction']['name'] = name	go_player[owner.m_name]['faction']['rank'] = 'Owner'		--send them to their new faction	owner:changeTeam(name, 'test')		return trueendfunction loadObject_faction()	go_faction = importTSF('factions', 'faction')	return trueendfunction saveObject_faction()	if (exportTSF(go_faction, 'factions', 'faction') == false) then		return false	end		return trueendfunction inviteToFaction(fname, name)	if (name == '' or fname == '' or go_player[name] == nil) then		return false	end		local player = g_arena:getPlayer(name)		table.insert(go_player[name]['faction']['invites'], fname)		if (player ~= nil) then		player:message('You have been invited to join the '..fname..' faction. Use ?acceptinvite <factionname> to accept')	end	return trueendfunction acceptInvite(plyr, name)	if (name == '' or nil == plyr) then		return false	end		--check to see if they even have an invite from the people they are trying to get one from.	local canjoin = false	for i=1, table.getn(go_player[plyr.m_name]['faction']['invites']) do		if (go_player[plyr.m_name]['faction']['invites'][i] == name) then			canjoin = true		end	end		if (canjoin == false) then		plyr:message('You have not received an invite from that faction.')		plyr:message('You can check invites by using ?listinvites')		return false	else		go_player[plyr.m_name]['faction']['name'] = name		go_player[plyr.m_name]['faction']['rank'] = member		go_player[plyr.m_name]['faction']['invites'] = { }		go_faction[name]['membercount'] = go_faction[name]['membercount'] + 1		plyr:changeTeam(name, 'test')	end	return trueendfunction listInvites(plyr)	if (plyr == nil or table.getn(go_player[plyr.m_name]['faction']['invites']) == 0) then		return false	end		plyr:message('^You have received invites from the following factions.')		for i=1, table.getn(go_player[plyr.m_name]['faction']['invites']) do		plyr:message(go_player[plyr.m_name]['faction']['invites'])	end	return trueendfunction disbandFaction(plyr)	if (plyr == nil) then		return false	end		local players = getn(go_player)	--g_arena:message(''..players[1])	for i=1, table.getn(players) do		if (go_player[players[i]]['faction']['name'] == go_player[plyr.m_name]['faction']['name']) then			go_player[players[i]]['faction']['name'] = go_player[i]['account']['name']			go_player[players[i]]['faction']['rank'] = 'Member'		end	end		go_faction[go_player[plyr.m_name]['faction']['name']] = nil	go_player[plyr.m_name]['faction']['name'] = plyr.m_name	go_player[plyr.m_name]['faction']['rank'] = 'Member'	plyr:changeTeam(plyr.m_name, 'test')	plyr:message('Your Faction no longer exists.')	return trueendfunction leaveFaction(plyr)	if (plyr == nil) then		return false	end		go_faction[go_player[plyr.m_name]['faction']['name']]['membercount'] = go_faction[go_player[plyr.m_name]['faction']['name']]['membercount'] - 1	go_player[plyr.m_name]['faction']['name'] = plyr.m_name	go_player[plyr.m_name]['faction']['rank'] = 'Member'	plyr:changeTeam(plyr.m_name, 'test')	plyr:message('You have left your old faction.')	return trueendfunction checkRank(target)	local name = target.m_name	if (go_player[name] == nil) then		return 'error'	end	return go_player[name]['faction']['rank']endfunction isValidFaction(plyr)	if (plyr == nil or go_player[plyr.m_name]['faction']['name'] == plyr.m_name) then		return false	end		if (go_faction[go_player[plyr.m_name]['faction']['name']] == nil) then		plyr:message('Your faction was disbanded.')		plyr:changeTeam(plyr.m_name, 'test')		go_player[plyr.m_name]['faction']['name'] = plyr.m_name		go_player[plyr.m_name]['faction']['rank'] = 'Member'	end		return trueendfunction promoteMember(name)	go_player[name]['faction']['rank'] = 'Officer'	local player = g_arena:getPlayer(name)	player:message('You have been promoted.')	return trueendfunction demoteMember(name)	go_player[name]['faction']['rank'] = 'Member'	local player = g_arena:getPlayer(name)	player:message('You have been demoted.')	return trueendfunction checkFactionInvites(plyr)	if (table.getn(go_player[plyr.m_name]['faction']['invites']) > 0) then		plyr:message('You have pending faction invites use ?list invites to view them.')	endend