All pastes #590941 Raw Edit

Someone

public lua v1 · immutable
#590941 ·published 2007-06-26 21:29 UTC
rendered paste body
 --Global Arerna -- g_arena=nil g_player=nilfunction Arena_OnCreate(arena)	-- Set our global value	g_arena = arena	-- Initialize random	math.randomseed(os.time())	--Create Vendorsendfunction test()		local vech1 = g_arena:vehicle_create(411, 2188, 272, 99) --create trainer	local vech2 = g_arena:vehicle_create(400, 2385, 277, 145) --create Certificate dealer	vech1:setFrequency(65535)	vech2:setFrequency(65535)	g_arena:message("NPCS respawned Succseffuly")	end function Player_OnDeath(killer, victim) -- player, player	--Give them Attribute points.	if (victim:getExperience() >= 25000) then -- If they kill someone with more than 25000 experience		if (victim:getExperience() >= 50000) then --If they kill someone with more than 50000 experience			if (victim:getExperience() >= 75000) then --If they kill someone with more than 75000 experience				if (victim:getExperience() >=100000) then -- If they kill someone with more than 100000 experience					killer:message("You have gained 10 Attribute Points")					killer:modPoints(10) -- Give them 10 Attribute Points				end				killer:message("You have gained 7 Attribute Points")				killer:modPoints(7) --  Give them 7 Attribute Points			end			killer:message("You have gained 5 Attribute Points")			killer:modPoints(5) -- Give them 5 Attribute Points		end		killer:message("You have gained 2 Attribute Points")		killer:modPoints(2) -- Give them 2 Attribute Points	end		--Check if they have enough Attribute Points and remind them how to spend them.	if (killer:getPoints() >= 50) then -- if they have 40 or more attribute points.		killer:message("You currently have 10 or more Attribute points, ")		killer:message("I suggest typing ?attribute if you have forgotten how to use them.")	endend function loc()	local tor = g_arena:getPlayer("Toriad")	local c = tor:coords()		tor:message("X = " .. c.x .. " Y = " .. c.y .. " Rotation = " .. c.rotation)end	function att()local tor = g_arena:getPlayer("Toriad")tor:modPoints(25)tor:message("you have 50 points!")end	function Player_OnJoin(player)		if (noSkills(player) == true)then		player:inventory_modify("Soldier",1)		player:message("It would seem you have never played Infantry RPG before, if this is true please type ?tutorial")	else		player:message("Welcome back to Infantry RPG " .. player.m_name .. ", type in ?login to join the world")	end			endfunction Player_OnUnspec(player) -- player	player:message("You need to type ?tutorial")	return falseendfunction noSkills(player) -- Finds out if a player has skills	if (player:skillFind(1) == false) then		if (player:skillFind(2) == false) then			if (player:skillFind(3) == false) then				if (player:skillFind(4) == false) then					if (player:skillFind(5) == false) then						if (player:skillFind(6) == false) then							if (player:skillFind(7) == false) then								if (player:skillFind(8) == false) then									if (player:skillFind(9) == false) then										if (player:skillFind(10) == false) then											return true										end										return false									end									return false								end								return false							end							return false						end						return false					end					return false				end				return false			end			return false		end		return false	endendfunction Msg_OnCommand(plyr, command, payload, recipient, msg_type) -- player, string, string, string, integer	local player = plyr	local ore = ""	local style = "" 	local team_n = ""	local team_p = ""	-- string.len("string") returns length of the string	-- string.find("string", ":") returns the position of the character found	-- if not found then returns nil.  Starts at 1.	-- string.sub("string", 1, 4) returns "stri", first index is the	-- starting position and last index is the ending position	-- string.sub("string", 4) returns "ing", with one argument	-- the function starts from the index and goes to the end		if (command == "?tutorial")then --Tutorial Command		player:message("Welcome to Infantry RPG, you will soon get used to ")		player:message("the style of gameplay however here are the basics.")		player:message("You will first notice you are your on team this is ")		player:message("because I am trying to keep a very RPG feel to this game.")		player:message("If you wish to team up with other people you will need ")		player:message("to goto a tavern in one of the many cities and type ")		player:message("?party 'The Name of the Party:Password if any' without the '.")		player:message("You get money and experience by killing other people or ")		player:message("mining and selling the resources back to the local NPC purchaser.")		player:message("There are 4 ways to advance your character in this Zone. ")		player:message("Training, Certifications, Permissions, and Class Changes.")		player:message("Each way has its pros and cons, by visiting a trainer in ")		player:message("a city you can recieve training which will allow you to use different weapons.")		player:message("Certifications work the same as training however you ")		player:message("might be required to get both in order to get a new class or use new weapons.")		player:message("Permissions allow you to do certain things such as build things, ")		player:message("drive certain vehicles and to get aura bonuses.")		player:message("Class Changing in this zone is different than any other zone, ")		player:message("first you must reach the requirements of that ")		player:message("class then you must find a trainer in the ")		player:message("city, and ask him to change your class. ")		player:message("Then you will be asked a couple of simple questions ")		player:message("about your decision to change classes and then allowed to change.");		player:message("When you are ready to join the game type ?login .")	end		if (command == "?login")then		if (noSkills(player) == true)then			player:inventory_modify("Soldier",1)			player:message("It would seem you have never played Infantry RPG before, if this is true please type ?tutorial")		end		player:unspec(player.m_name,"unknown")				end	if (command == "?attribute") then		plyr:message("Each Attribute costs you 40 points. for list of attributes type ?list attributes.")		plyr:message("In order to purchase an attribute type ?levelup 'name of attribute'")	end		if (command == "?list") then -- If they are asking for a list		if (payload == "attributes") then -- If that list is attributes.			plyr:message("Agility")			plyr:message("Endurance")			plyr:message("Health")			plyr:message("Intelligence")			plyr:message("Reflexes")			plyr:message("Strength")		else			plyr:message("?list <argument here>")		end	end		if (command == "?levelup") then -- If they are trying to level up something		if (payload == "Agility" or payload == "agility") then -- If they are trying to level up Agility			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Agility", 1)				plyr:message("Your Agility has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		elseif (payload == "Endurance" or payload == "endurance") then			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Endurance", 1)				plyr:message("Your Endurance has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		elseif (payload == "Health" or payload == "health") then			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Health", 1)				plyr:message("Your Health has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		elseif (payload == "Intelligence" or payload == "intelligence") then			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Intelligence", 1)				plyr:message("Your Intelligence has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		elseif (payload == "Reflexes" or payload == "reflexes") then			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Reflexes", 1)				plyr:message("Your Reflexes has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		elseif (payload == "Strength" or payload == "strength") then			if (plyr:getPoints() >= 50) then -- Do they have enough Attribute points?				plyr:modPoints(-50)				plyr:inventory_modify("Strength", 1)				plyr:message("Your Strength has increased by 1")			else				plyr:message("You need " .. (50 - plyr:getPoints()) .. " more attribute points.")			end		else			plyr:message("?levelup <argument required>")		end	end	if (command == "?craft") then		if (string.len(payload) > 0) and (string.find(payload, ":") ~= nil) then			ore = string.sub(payload, 1, (string.find(payload, ":") - 1))			style = string.sub(payload, (string.find(payload, ":") + 1))		else			plyr:message("No Payload. E.X. ?craft <ore here>:<style here E.X Legging, Neck, Chest>")		end		if (ore == "Noobium") then			plyr:message("Craft part works!")			if (style == "Leggings") then				plyr:message("style part works!")			else				plyr:message("You did not try to use a valid Style")			end		else			plyr:message("You did not try to use a valid ore")		end	end			if (command == "?party") then		if (string.len(payload) > 0) and (string.find(payload, ":") ~= nil) then			team_n = string.sub(payload, 1, (string.find(payload, ":") - 1))			team_p = string.sub(payload, (string.find(payload, ":") + 1))			if (innOne(plyr) == true) then				plyr:changeTeam(team_n, team_p)			end		else			plyr:message("You need to make sure your putting the part name in E.X ?Party Killers:42")		end	end		if (command == "?permission") then		if (payload == "Squad Leader") then			if (plyr:getStat(2) == 1) then				plyr:message("You are about to purchase Academy Permission to start the Command Branch, repeat to confirm.")				plyr:setStat(2, 2)			elseif (plyr:getStat(2) == 2) then				plyr:message("You now have permission to begin the Command Branch.")				plyr:inventory_modify("Academy Permission", 1)				plyr:setStat(2, 0)			else				plyr:message("You have not sacraficed Toriad's soul at a shrine.")			end		elseif (payload == "PsiOps") then			if (plyr:getStat(2) == 1) then				plyr:message("You are about to purchase Permission to Ascend to start the Command Branch, repeat to confirm.")				plyr:setStat(2, 2)			elseif (plyr:getStat(2) == 2) then				plyr:message("You now have permission to begin the Command Branch.")				plyr:inventory_modify("Permission to Ascend", 1)				plyr:setStat(2, 0)			else				plyr:message("You have not sacraficed Toriad's soul at a shrine.")			end		elseif (payload == "Missing") then			if (plyr:getStat(2) == 1) then				plyr:message("You are about to purchase Unknown Permission to start the Command Branch, repeat to confirm.")				plyr:setStat(2, 2)			elseif (plyr:getStat(2) == 2) then				plyr:message("You now have permission to begin the Command Branch.")				plyr:inventory_modify("Unknown Permission", 1)				plyr:setStat(2, 0)			else				plyr:message("You have not sacraficed Toriad's soul at a shrine.")			end		else			plyr:message("Invalid Syntax. Correct Usage E.X. ?permisson <Class Name or Weapon/Armor Type>")		end	endend	function trainCheck(xp, cash, plyr, item) --Bring in XP, cash ,Plyr, and Item requirements output table	local myTable = {false, false, false}		if (plyr.getExperience() >= xp) then		myTable[1] = true	end		if (plyr.getCash() >= cash) then		myTable[2] = true	end		if (plyr.inventory_find(item) == 0) then		myTable[3] = true	end		return myTableendfunction ubah(plyr)local statplyr:setStat(1, 10)stat = plyr:getStat(1)plyr:message(stat)endfunction purchaseSkill(plyr, item, expr, cash)	plyr:message(item .. " requires 20,000 Experince and 15,000 credits.")			if (plyr:inventory_find(item) < 1) then				plyr:message("inventory find works..")				if (plyr:getCash() >= cash) then					plyr:message("getCASH() works.")					if (plyr:getExperience() >= expr) then						plyr:modExperience(-expr)						plyr:modCash(-cash)						plyr:message("Have your Training.")						return true					else						plyr:message("You need " .. expr .. " Experience, you only have " .. plyr:getExperience() .. ".")						return false					end				else					plyr:message("You need " .. cash .. " Credits, you only have " .. plyr:getCash() .. ".")					return false				end			else				plyr:message("You have already been trained in this, you cannot learn anything else.")				return false			end	return falseendfunction Vehicle_OnProduce(vech, plyr, menuitem) -- vehicle, player, integer	local vid = vech:vehicletypeid()	local menu = menuitem + 1			--For testing---	--g_arena:message("'Vehicle_OnProduce' called by " .. plyr.m_name .. " with vid " .. vid .. " and menu item " .. menuitem)	------------------		if (vid == 411) then -- It's the training vehicle		if (menu == 1) then --They've pressed menu item 1			if (purchaseSkill(plyr, "Command Training", 30000, 15000) == true) then				return true			else				return false			end		elseif (menu == 2) then --They've pressed menu item 2			if (purchaseSkill(plyr, "Mental Training", 35000, 20000) == true) then				return true			else				return false			end		elseif (menu == 3) then			if (purchaseSkill(plyr, "Unknown Training", 50000, 30000) == true) then				return true			else				return false			end		end	end	if (vid == 400) then --It's the certificate Vehicle		if (menu == 1) then			if (purchaseSkill(plyr, "Command Certification", 30000, 15000) == true) then				return true			else				return false			end		elseif (menu == 2) then			if (purchaseSkill(plyr, "Mental Certification", 35000, 2000) == true) then				return true			else				return false			end		elseif (menu == 3) then			if (purchaseSkill(plyr, "Missing Certification", 50000, 2000) == true) then				return true			else				return false			end		end	end	if (vid == 401) then -- It's the Shrine they are using.		if (menu == 1) then			plyr:message("You can now ask for the following class changes using ?permission Class")			if (plyr:skillFind(1) == true) then				plyr:message("Squad Leader")				plyr:message("PsiOps")				plyr:message("Missing")			end			if (plyr:skillFind(2) == true) then				plyr:message("City Leader")			end			if (plyr:skillFind(3) == true) then				plyr:message("Commander")			end			if (plyr:skillFind(4) == true) then				plyr:message("You have reached the top of the Command Branch, there is nothing better for you.")			end			if (plyr:skillFind(5) == true) then				plyr:message("Psionic")			end			if (plyr:skillFind(6) == true) then				plyr:message("Psiopic")			end			if (plyr:skillFind(7) == true) then				plyr:message("You dont need my permission Psiopic, there is nothing better for you.")			end			if (plyr:skillFind(8) == true) then				plyr:message("Lost")			end			if (plyr:skillFind(9) == true) then				plyr:message("Hidden")			end			if (plyr:skillFind(10) == true) then				plyr:message("Your already hidden, the only change for you is to be found which I cannnot help with.")			end			plyr:message("---------------------------------------------")			plyr:message("You may also spend this permission to meet a Weapon or Armor type requirement, by using ?permission Type")			plyr:setStat(2, 1) -- Enable purchase of Permissions.		end	endendfunction Vehicle_OnDeath(vech, plyr, itemid) -- vehicle, player, integer	local vid = vech:vehicletypeid()	local pteam = plyr:getTeam()		if (vid == 402) then --If they killed Toriad of Malion		g_arena:message("Toriad of Malion has been killed by " .. plyr.m_name .. " from team " .. pteam.m_name .. ".")		plyr:message("You have captured the soul of Toriad of Malion, sacrafice his soul at a Shrine of Malion and choose your reward.")		plyr:inventory_modify("Soul of Toriad", 1)	endendfunction innOne(plyr)	local g_x1 = 1791	local g_y1 = 1546	local g_x2 = 2063	local g_y2 = 1682	local coords = plyr:coords()		if (((coords.x > g_x1) and (coords.x < g_x2) and (coords.y > g_y1) and (coords.y < g_y2))) then		return true	else		return false	endendfunction Arena_OnGameStart()		local trainer1 = g_arena:vehicle_create(411, 2188, 272, 99) --create Trainer	local cert1 = g_arena:vehicle_create(400, 2385, 277, 145) --create Certificate dealer	local shrine1 = g_arena:vehicle_create(401, 2378, 1073, 180) -- Creat the Shrine if Malion	local toriad1 = g_arena:vehicle_create(402, 775, 807, 84) -- Create Toriad of Malion		trainer1:setFrequency(65535)	cert1:setFrequency(65535)	g_arena:message("NPCS respawned Succseffuly")endfunction Arena_OnGameEnd()		local trainer1 = g_arena:vehicle_create(411, 2188, 272, 99) --create Trainer	local cert1 = g_arena:vehicle_create(400, 2385, 277, 145) --create Certificate dealer	local shrine1 = g_arena:vehicle_create(401, 2378, 1073, 180) -- Creat the Shrine if Malion	local toriad1 = g_arena:vehicle_create(402, 775, 807, 84) -- Create Toriad of Malion		trainer1:setFrequency(65535)	cert1:setFrequency(65535)	g_arena:message("NPCS respawned Succseffuly")end