--- [[ Global Variables ]] ---------- --g_arena = nil -- The global arena class, to avoid having to pass it around functions g_state = nil g_bGameRunning = false -- Is the game running? g_outputdebug = false --Set to true for Verbose reporting. --g_keyitemevent = nil --- [[ Functions ]] ------- function CheckKeyItems() g_arena:message("Event") return false end -- when the arena is created, it runs this function Arena_OnCreate(arena) g_arena = arena math.randomseed(os.time()) end -- Code in this function is carried out when the player joins function Player_OnJoin(player) player:message("Lua is Running") player:setstat(1, 1) end function Player_OnUnspec(player) end function Player_OnWarpItem(user, itemid, target) -------------------------------------------------Angle Up if (itemid == 119) then local angle = user:getstat(1) if (angle == 10) then user:message("Thats the highest this thing goes!") else user:setstat(1, angle + 1) local nangle = user:getstat(1) user:message("Angle is now " .. nangle .. "") return false end --------------------------------------------------Angle Down elseif (itemid == 121) then local angle = user:getstat(1) if (angle == 0) then user:message("Thats the lowest this thing goes!") else user:setstat(1, angle - 1) local nangle = user:getstat(1) user:message("Angle is now " .. nangle .. "") return false end -------------------------------------------------------GL Fire elseif (itemid == 122) then local c = user:coords() local angle = user:getstat(1) local angletofire = "GL Angle 1" if (angle == 2) then angletofire = "GL Angle 2" elseif (angle == 3) then angletofire = "GL Angle 3" elseif (angle == 4) then angletofire = "GL Angle 4" elseif (angle == 5) then angletofire = "GL Angle 5" elseif (angle == 6) then angletofire = "GL Angle 6" elseif (angle == 7) then angletofire = "GL Angle 7" elseif (angle == 8) then angletofire = "GL Angle 8" elseif (angle == 9) then angletofire = "GL Angle 9" elseif (angle == 10) then angletofire = "GL Angle 10" end g_arena:explosion_create(angletofire, c.x, c.y, c.rotation + 5) ------------------------------------------------------ end return true end -- when the game starts, it sets gameRunning to true function Arena_OnGameStart() g_bGameRunning = true end -- when the game finishes, it sets gameRunning to false function Arena_OnGameEnd() g_bGameRunning = false end function Item_OnPickUp(looter, loot, loot_type, amounttopickup) looter:message("Item") g_keyitemevent = event_create(CheckKeyItems(), -100, g_arena) return true end function Vehicle_OnProduce(producer, user, menuitem) if g_outputdebug == true then mongoose = g_arena:getPlayer("Mongoose") mongoose:message("Produce_Vech") end return true end -- when a vehicle is created function Vehicle_OnCreate(vehicle) if g_outputdebug == true then mongoose = g_arena:getPlayer("Mongoose") mongoose:message("Vehicle Made " .. vehicle:vehiclename() .. "") end end -- when a vehicle is destroyed function Vehicle_OnDeath(victim, killer, itemid) if g_outputdebug == true then mongoose = g_arena:getPlayer("Mongoose") mongoose:message("Vehicle Died") end end -- when a player dies to another player (or computer turret/environmental effect) function Vehicle_OnDeath(killer,victim) if g_outputdebug == true then mongoose = g_arena:getPlayer("Mongoose") mongoose:message("" .. killer.m_name .. " Killed " .. victim.m_name .. " With ") end end