KylerXX
Active Member
- Joined
- Jun 24, 2010
- Messages
- 439
- Reaction score
- 30
I know that are existing more Arena Battle scripts, but my script its easy to configure and its works.
actions.xml
Comments please:thumbup:
LUA:
function onUse(cid, item, frompos, itemEx, topos) -- script by xafterin
-- functions--
local coord = {
x = {93, 97}, -- {pos X first corner, pos X of second corner of arena}
y = {122, 124}, ---- {pos Y first corner, pos Y of second corner of arena}
z = 7 -- Position Z
}
function checkp()
for areax = coord.x[1], coord.x[2] do
for areay = coord.y[1], coord.y[2] do
local area = {x = areax, y = areay, z = coord.z, stackpos = 253}
if isPlayer(getThingFromPos(area).uid) then
return true
end
end
end
return false
end
-- end functions --
local t = { -- configurayion
lvlReq = 1, -- required level
msg = "Go fight!", -- Message on enter to arena
player1 = {{x = 99, y = 122, z = 7, stackpos = 253}, {x = 95, y = 123, z = 7}}, -- {required position of player1 , pos to go}
player2 = {{x = 99, y = 124, z = 7, stackpos = 253}, {x = 95, y = 124, z = 7}}, -- {required position of player2 , pos to go}
effects = {12} --efect
}
local s = { -- dont touch
p1 = getThingFromPos(t.player1[1]).uid,
p2 = getThingFromPos(t.player2[1]).uid
}
if not checkp() then
if isPlayer(s.p1) and isPlayer(s.p2) then
if getPlayerLevel(s.p1) >= t.lvlReq and getPlayerLevel(s.p2) >= t.lvlReq then
doTeleportThing(s.p1, t.player1[2])
doTeleportThing(s.p2, t.player2[2])
doSendMagicEffect(t.player1[2], t.effects[1])
doSendMagicEffect(t.player2[2], t.effects[1])
doPlayerSendTextMessage(s.p1,18,t.msg)
doPlayerSendTextMessage(s.p2,18,t.msg)
else
doPlayerSendCancel(cid, "Dont enough level, anyone needs required level ("..t.lvlReq..").")
end
else
doPlayerSendCancel(cid, "Need more players to enter arena.")
end
else
doPlayerSendCancel(cid, "If anyone is in battle cant enter!")
end
return true
end
actions.xml
Code:
<action actionid="aid" event="script" value="arenabattle.lua"/>
Comments please:thumbup:
Last edited: