g_state = nil
g_arena = nil
g_portal = nil -- The currently active portal
g_portalqueued = nil -- Player queued for a portal (used for spawning vehicles out of portals)
-- when the arena is created, it runs this
function Arena_OnCreate(arena)
g_arena = arena
math.randomseed(os.time())
end
function PhaseBack(playerbase)
-- Obtain the player who needs to phase back
local phased = player_frombase(playerbase)
-- Check he's still around
if (phased:valid() == true) then
-- If so, grab the value in stat position 50 (which is his old vehicle) and change him back!
phased:setVehicle(phased:getstat(50))
end
return false
end
function Player_OnWarpItem(user, itemid, target)
---------------------------------Greater Haste--------------------------
if (itemid == 111) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Greater Haste Enchant", 1)
end
end
------------------------------Stone Skin-----------------------------------
elseif (itemid == 99) then
-- Store his old vehicle type in stat position 50
user:setstat(50, user:getVehicle():vehicletypeid())
-- Change him to the phased vehicle
user:setVehicle(110)
-- Create an event to phase him back in 60 seconds
event_createarg(PhaseBack, 60000, g_arena, user.m_base)
return false
---------------------------------Cold Resist--------------------------
elseif (itemid == 20) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Major Protective Cold", 1)
end
end
---------------------------------Fire Resist--------------------------
elseif (itemid == 19) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Major Protective Fire", 1)
end
end
---------------------------------Lightning Resist--------------------------
elseif (itemid == 152) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Major Protective Lightning", 1)
end
end
---------------------------------Haste--------------------------
elseif (itemid == 153) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Minor Haste Enchant", 1)
end
end
---------------------------------Cold minor resist--------------------------
elseif (itemid == 172) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Minor Protective Cold", 1)
end
end
---------------------------------Fire minor resist--------------------------
elseif (itemid == 171) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Minor Protective Fire", 1)
end
end
---------------------------------Lightning minor resist--------------------------
elseif (itemid == 156) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Minor Protective Lightning", 1)
end
end
---------------------------------Endure Elements--------------------------
elseif (itemid == 5) then
local playerteam = user:getTeam()
local playercoords = user:coords()
local teamnum = playerteam:num()
for x = 1, teamnum do
local teammate = playerteam:get(x)
-- If not in spec..
if (teammate:spectator() == false) then
-- Give him haste
teammate:inventory_modify("Endure Element", 1)
end
end
----------------------------------------------------------------------------------------
return false
end
return true
end
function Player_OnJoin(player)
player:message("Debug message: Lua loaded")
end